-
Notifications
You must be signed in to change notification settings - Fork 459
Factor annotations out of Core #208
Conversation
robrix
left a comment
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.
Ready for review.
| stripAnnotations (Term t) | ||
| | Just c <- prj t, Ann _ b <- c = stripAnnotations b | ||
| | otherwise = Term (hmap stripAnnotations t) | ||
| stripAnnotations :: (HFunctor sig, forall g . Functor g => Functor (sig g)) => Term (Ann :+: sig) a -> Term sig a |
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.
Now the type of stripAnnotations guarantees that there aren’t any present.
| -- * Parsers (corresponding to EBNF) | ||
|
|
||
| core :: (TokenParsing m, Monad m) => m (Term Core User) | ||
| core :: (TokenParsing m, Carrier sig t, Member Core sig, Monad m) => m (t User) |
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.
Eventually we can (and should) generate annotations for parsed terms as well.
patrickt
left a comment
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.
Love this—such a great exhibition for why the effects + syntax distinction is artificial.
This PR splits an
Anntype out ofCore, mostly as housekeeping but also to demonstrate sums of strongly-typed syntax.