#4370: Bring back monad comprehensions
---------------------------------+------------------------------------------
    Reporter:  simonpj           |        Owner:  nsch        
        Type:  feature request   |       Status:  new         
    Priority:  normal            |    Milestone:  7.2.1       
   Component:  Compiler          |      Version:  6.12.3      
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by nsch):

 That looks sweet, but how would you typecheck that? My naiv implementation

 {{{
          -- Type check 'mmap' with 'forall a b. (a -> b) -> m_ty a -> m_ty
 b'
        ; mmap_op' <- tcSyntaxOp MCompOrigin mmap_op $
                          mkForAllTy alphaTyVar $ mkForAllTy betaTyVar $
                              (alphaTy `mkFunTy` betaTy)
                              `mkFunTy`
                              (m_ty `mkAppTy` alphaTy)
                              `mkFunTy`
                              (m_ty `mkAppTy` betaTy)
 }}}

 fails on compilation:

 {{{
     Couldn't match expected type `forall a b. (a -> b) -> [a] -> [b]'
                 with actual type `(a -> b) -> m a -> m b'
     In a stmt of a monad comprehension: then group by x using groupWith
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4370#comment:33>
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