-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I was curious why speff is so much better at countdown than effectful and saw that access to an effect handler is just a single array access (for comparison effectful accesses a few arrays, an IORef and performs safety checks), so that makes sense. However, looks like this approach suffers from the same problem described in hasura/eff#12.
import Sp.Eff
import Sp.Util
data SomeEff :: Effect where
SomeAction :: SomeEff m String
bad1 :: Either String String
bad1 = runEff . runError @String $ do
interpret0 (\SomeAction -> embed $ throw "not caught") $ do
send SomeAction `catch` \(_ :: String) -> return "caught"
bad2 :: String
bad2 = runEff . runReader "unlocaled" $ do
interpret0 (\SomeAction -> embed $ ask) $ do
local (\_ -> "localed") $ send SomeAction>>> bad1
Left "not caught"
>>> bad2
"unlocaled"
I presume interpose exhibits similar behavior, i.e. given effects A and B, if you make an effect handler of A use operations of B, then interpose handler of B and call an operation of A, it'll use the old handler of B, not the interposed one.
Metadata
Metadata
Assignees
Labels
No labels