kowainik / kowainik/eio

Add MonadIO instance for EIO

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
57
Forks
2
PR merge metrics
No merged PRs in 30d

Description

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:
```idris
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)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

Contributor guide

Open the contributing guide

Research direction

Start by reading src/EIO.hs around lines 53-54 and the existing EIO definition to understand how its error type is combined. Investigate whether Applicative, Monad, and MonadIO instances can satisfy the type constraints shown in the compiler error. Done means the requested instances compile without the reported mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.