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

Better support for throwing exceptions #39

Open
edsko opened this issue Jun 11, 2014 · 0 comments
Open

Better support for throwing exceptions #39

edsko opened this issue Jun 11, 2014 · 0 comments

Comments

@edsko
Copy link
Contributor

edsko commented Jun 11, 2014

At the moment acid-state uses

newtype Update st a = Update { unUpdate :: State st a }
    deriving (Monad, Functor, MonadState st)

newtype Query st a  = Query { unQuery :: Reader st a }
    deriving (Monad, Functor, MonadReader st)

Neither of these monads is particularly suitable for throwing exceptions. The only possibility is to use fail, but neither the Reader monad nor the (lazy) State monad is strict enough so that in

foo = do
    fail "The query will continue perfectly fine after this fail"
    restOfQuery

does what one would expect (restOfQuery gets executed). Ideally, there would be explicit support for exceptions (ErrorT, perhaps), with the expected strictness properties.

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

No branches or pull requests

1 participant