| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Bluefin.Capability.JumpTo
Documentation
JumpTo allows you to jump back to a previously-set location.
A "jump" is equivalent to an untyped early return, or more
precisely an early return of type (), which is itself an
exception of type ().
Capability
Handlers
Arguments
| :: forall (es :: Effects). (forall (e :: Effects). JumpTo e -> Eff (e :& es) ()) | |
| -> Eff es () | ͘ |
runPureEff $withStateSource$ \source -> do n <-newStatesource 5 total <- newState source 0withJumpTo$ \done -> forever $ do n' <-getnmodifytotal (+ n') when (n' == 0) $jumpTodone modify n (subtract 1) get total 15