-
Notifications
You must be signed in to change notification settings - Fork 204
Put everything in terms of FreeT and ExceptT #745
Conversation
| instance GM.GmOut m => GM.GmOut (IDErring m) where gmoAsk = lift GM.gmoAsk | ||
| instance GM.GmState m => GM.GmState (IDErring m) where gmsGet = lift GM.gmsGet; gmsPut = lift . GM.gmsPut; gmsState = lift . GM.gmsState | ||
| instance (Functor f, MonadFree f m) => MonadFree f (IDErring m) where wrap x = liftWith (\run -> wrap $ fmap run x) >>= restoreT . return | ||
|
|
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.
Please do not let lines get longer than 115 chars (preferably 80), else the github UI does not show them properly
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.
Huh, shows fine for me. I liked hiding the obvious boilerplate way to the right.
|
(I hope you tick the squash box on merge.) |
|
|
|
@Gurkenglas is this still relevant? |
|
No response for 3 months, i guess this one is dead. |
|
Agree, and there was a different refactor that achieved a similar goal that landed after. @Gurkenglas if you want to pursue this, re-open the PR |
I pulled on some loose threads and this happened.
A bunch of code was reimplementing FreeT, another bunch could be made prettier with ExceptT, such as diverging indentation. Beyond that there was much refactoring, such as replacing some lens code with lens oneliners.
The alias names/structure aren't final. Maybe there should be more newtype wrapping for better errors? Sucks that type aliases aren't properly used in GHC's error messages, though.
I haven't implemented gmask for FreeT yet. I'm not sure whether it's needed/possible.
Depends on alanz/ghc-mod#12 and alanz/HaRe#54 because FreeT doesn't have MonadTransControl, but if that's a hassle one could work around those dependency updates.