Skip to content

Syntactic sugar for comonads

It could be useful to have this as extension.

More details: http://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html chapter "Syntactic sugar for comonads"

method
    wa> expr1
    wb> expr2
    wc> expr3

= -- this desugars to:

   \wa ->
let wb =      extend (\this -> expr1) wa
    wc =      extend (\this -> expr2) wb
 in extract $ extend (\this -> expr3) wc

and

method
    expr1
    expr2
    expr3
=
   \_wa ->
let _wb =      extend (\this -> expr1) _wa
    _wc =      extend (\this -> expr2) _wb
in  extract  $ extend (\this -> expr3) _wc
Trac metadata
Trac field Value
Version
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information