Skip to content

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