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

Add MonadIO instance for EIO #14

Open
JonathanLorimer opened this issue Apr 3, 2021 · 0 comments
Open

Add MonadIO instance for EIO #14

JonathanLorimer opened this issue Apr 3, 2021 · 0 comments

Comments

@JonathanLorimer
Copy link

JonathanLorimer commented Apr 3, 2021

I am not sure if this is possible. The first hurdle is getting an applicative and monad instance. The naive applicative implementation gives this error:

src/EIO.hs:54:15-54: error:
    • Couldn't match type ‘e’ with ‘e <> e’
      Expected: EIO e b
        Actual: EIO (e <> e) b
      ‘e’ is a rigid type variable bound by
        the instance declaration
        at src/EIO.hs:53:10-28
    • In the expression: af >>= \ f -> ax >>= \ x -> return (f x)
      In an equation for ‘<*>:
          af <*> ax = af >>= \ f -> ax >>= \ x -> return (f x)
      In the instance declaration for ‘Applicative (EIO e)’
    • Relevant bindings include
        ax :: EIO e a (bound at src/EIO.hs:54:10)
        af :: EIO e (a -> b) (bound at src/EIO.hs:54:3)
        (<*>) :: EIO e (a -> b) -> EIO e a -> EIO e b
          (bound at src/EIO.hs:54:6)
   |
54 |   af <*> ax = af >>= \ f -> ax >>= \ x -> return (f x)
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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