[GHC] #7935: Syntactic sugar for comonads

GHC cvs-ghc at haskell.org
Sun May 26 21:00:58 CEST 2013


#7935: Syntactic sugar for comonads
-----------------------------+----------------------------------------------
Reporter:  wvv               |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:                    |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  None/Unknown      |      Blockedby:                  
Blocking:                    |        Related:                  
-----------------------------+----------------------------------------------
 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
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7935>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list