#3136: monad syntax extension
------------------------------+---------------------------------------------
 Reporter:  neodymion         |          Owner:                  
     Type:  feature request   |         Status:  new             
 Priority:  normal            |      Milestone:                  
Component:  Compiler          |        Version:  6.10.1          
 Severity:  normal            |     Resolution:                  
 Keywords:                    |       Testcase:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
------------------------------+---------------------------------------------
Comment (by claus):

 And if you believe the advocates of `Control.Applicative`, this becomes:
 {{{
 >let readInt a = read a::Int
 >:m +Control.Applicative
 >print =<< ((+) <$> (readInt <$> getLine) <*> (readInt <$> getLine))
 1
 2
 3
 }}}
 or even
 {{{
 >:set -XNoMonomorphismRestriction
 >let (+) = liftA2 (Prelude.+)
 >print =<< ((readInt <$> getLine) + (readInt <$> getLine))
 2
 3
 5
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3136#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to