-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] feat(std): replace parser lib with more generic version #687
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the basic plan of adding a StreamLike
type which Parser
can be abstracted over but I think it may be a good a idea to take a step back and go for something a bit simpler first (see other comments). The ZipWith
, Lazy
etc abstractions over StreamLike
are neat, but aren't strictly necessary to for the basic idea to work so I think forcusing on just getting Parser
working with StreamLike
first will make it easier (and then the rest can be added later).
(Seems I forgot/failed to press submit review on this, sorry for the delay!)
let string @ { String, ? } = import! std.string | ||
|
||
// TODO How handle atom streams generically? Stream-like interface? | ||
// TODO How handle error position generically? Zip stream with enumeration? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to represent a position as an associated type however that does not work in gluon (yet). Could maybe parameterize StreamLike
with a position argument though.
686: [WIP] feat(std): add monad transformer interface, StateT, and LazyT r=Marwes a=Etherian ## Description Adds a monad-transformer interface `Transformer`, a State monad transformer `StateT`, and a Lazy monad transformer `LazyT` to the standard library. ## Related PRs Lays groundwork for Streamlike and the new parser #687. ## Status **In Development** ### Outstanding design questions - [x] ~~Can and should `StateT` be replaced by the effects system?~~ ([not for the time being, at least](#686 (comment))) - [ ] Should `Transformer` require `monad` field? - [ ] Should StateT and LazyT (and other monad transformers) be merged with their non-transformer counterparts? ### To Do - [x] ~~Fix StateT's implicit parameter bugs~~ (#688 & #689) - [ ] add tests - [ ] add inline docs ## Prior Art - StateT - [Haskell](https://hackage.haskell.org/package/transformers-0.5.6.2/docs/src/Control.Monad.Trans.State.Lazy.html#StateT) - [Idris](https://github.com/idris-lang/Idris-dev/blob/master/libs/base/Control/Monad/State.idr) - [Implementing Applicative (<*>) for StateT](https://stackoverflow.com/questions/27903650/implementing-applicative-for-statet) - MonadTrans - [Haskell](https://hackage.haskell.org/package/transformers/docs/src/Control.Monad.Trans.Class.html#MonadTrans) - [Idris](https://github.com/idris-lang/Idris-dev/blob/master/libs/base/Control/Monad/Trans.idr) Co-authored-by: Etherian <[email protected]> Co-authored-by: Markus Westerlind <[email protected]>
Ignore But what do you think of the |
It doesn't seem to compile as is :( . Searched for what Haskell does with its equivalent |
Sorry. It didn't compile because I wrote it wrong the first time. If I understand correctly, the answerer of that question says that
But doing so works just fine in Gluon. |
Description
Adds a
Parsable
interface and a parser combinator library based on it to replace the current one.Related PRs
Depends on #686.
Similar concept to the Streamlike interface (#737)
Status
In Development
Outstanding design questions:
How should parser handle errors and custom error types?(It will use its own error type. No customization for now.)To Do
Prior art
Future Possibilities
Parsable
on top ofStreamlike
or otherwise take advantage of their relatedness.Indexable
->Parsable
?