Open lambdageek opened 6 years ago
I ended up needing a MonadIO instance, so I wrote https://github.com/visq/language-c/pull/59.
Fixed partially in https://github.com/visq/language-c/pull/77
The user state is broken out into a MonadState
instance, but not the other features.
Here's a wishlist item I've been thinking about: I wish
Trav
was a monad transformer built up out of smaller simpler monad transformers.Trav s a
is meant to be extensible via theuserState
components
and thehandleDecl
function fromMonadTrav
, but this isn't always enough.For example if I want to handle some events by running some kind of imperative operation (e.g. some kind of Union-Find algorithm or maybe feeding facts to an external solver like Z3) that's not easy to do right now.
Instead of baking in user state into the monad,
Trav
should be a monad transformer:TravT m a
andTrav s a = TravT (State s) a
(I'm not sure how user state interacts with Trav's exception mechanism).In fact, ideally the
MonadSymtab
andMonadName
, andMonadCError
parts ofTrav
should all be broken out into separate transformers that layer on the functionality one by one (so that if I want to have some kind of extended symbol information, for example, I could add my ownMonadSymtab
instance in a custom stack). The defaultTravT
should be a newtype around a particular instantiation of a stack of simpler transformers..