📖Do be do be do

authors
Sam Lindley AND Conor McBride AND Craig McLaughlin
year
2016
  • based on Plotkin and Power’s algebraic effects

    • and Plotkin and Pretnar’s handlers for algebraic effects

  • operators generalize functions and effects

    • pure function is an operator with no effects

  • what bidirectional effect type system means?

  • what is effect polymorphism?

  • works in strict language (but with possibly delayed computations)

    • “The absence of explicit plumbing in Frank depends crucially on the fact that Frank, unlike Haskell, has a fixed evaluation order.”

  • handling effects is just a function

    state : S -> <State S>X -> X
    state _ x            = x                 -- this catch-all does not include effects---only values
    state s <get -> k>   = state s (k s)
    state _ <put s -> k> = state s (k unit)
    
  • handling multiple effects

    pipe : <Send X>Unit -> <Receive X>Y -> [Abort]Y
    pipe <send x -> s> <receive -> r> = pipe (s unit) (r x)
    pipe <_>           y              = y
    pipe unit          <_>            = abort!