Skip to content
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

MonadError, the errorful Monad transformer #185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alrunner4
Copy link

Utilities for working simply with mainly IO-threaded programs.

public export
overIORef : IORef a -> ( a -> IOError e a ) -> IOError e a
overIORef ref xform = do
val <- lift( readIORef ref )
Copy link
Author

@alrunner4 alrunner4 Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Occurred to me: should lift be in scope, despite no import Control.Monad.Trans here, and no import public in Control.Monad.Error? I'm guessing that it's visible because it's part of an interface...?

@edwinb
Copy link
Owner

edwinb commented Jan 19, 2020

There's a test failure here due to the prelude change (I should do something about the line number display there, it is fairly useless.)

Still, I'm not sure this should be in base - it's probably better in contrib for now, because I would rather not encourage monad transformers for this sort of thing. Of course people might want to do things that way, which is fine, and it's understandable if people want to do things in a way which is familiar from Haskell, but I'm shortly going to add an error+state+IO type which I've been finding works quite nicely.

(I know we have State and Trans in base too. Should we?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants