Do Notation
Do notation for Fantasy Land monad types.
Examples
It uses yield
to "unbox" the Monad (the <-
in Haskell), which can then be transformed and fed to the next Monad in the Do
block. The Do
function returns the last Monad in the Do
block:
const Do = let maybeString = console// 'Just("bazbarfoo")'
Implementation
The entire implementation is very succinct and simple:
{ const generator = return { const res = generatornextv if resdone return resvalue else return resvalue }} moduleexports = Do: Do