Skip to content

Commit

Permalink
Branch readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjaguarpaw committed Oct 30, 2024
1 parent 42767b0 commit 2ec6979
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions BRANCH_README
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
This approach is hard to make work. The key element is to make sure
that the constraints you get from applying a handler decay naturally.
For example if you have

(e1 :> effs, e2 :> effs) => State s e1 -> Exception s e2 -> Eff effs r

and then apply the state handler, we instantiate effs to (e1 :& effs)
so we end up with

(e1 :> e1 :& effs, e2 :> e1 :& effs) => State s e1 -> Exception s e2 -> Eff (e1 :& effs) r

and the contraints decay to

(e2 :> effs)

because (e1 :> e1 :& effs) is immediately solved and, because e1 is
universally quantified, (e2 :> e1 :& effs) decays to (e2 :> effs)
(using the incoherent instance).

With the "Has" stuff, trying to pass values in a constraint, I haven't
found a way to make the constraints decay properly. The effectful
setup does make the constraints decay propertly, but it takes a
different approach. The Bluefin approach is to use the incoherent
instance to skip past a universal type variable. The effectful
approach is to use an overlapping instance to skip past a known type,
that is, the handler is:

evalStateLocal :: s -> Eff (State s ': es) a -> Eff es a

0 comments on commit 2ec6979

Please sign in to comment.