#6041: Program hangs when run under Ubuntu Precise
----------------------------+-----------------------------------------------
  Reporter:  dsf            |          Owner:                  
      Type:  bug            |         Status:  new             
  Priority:  high           |      Milestone:  7.4.2           
 Component:  Compiler       |        Version:  7.4.1           
Resolution:                 |       Keywords:                  
        Os:  Linux          |   Architecture:  Unknown/Multiple
   Failure:  Runtime crash  |     Difficulty:  Unknown         
  Testcase:                 |      Blockedby:                  
  Blocking:                 |        Related:                  
----------------------------+-----------------------------------------------
Changes (by guest):

  * status:  closed => new
  * resolution:  worksforme =>


Comment:

 Hello

 I was very intrigued by this report, and hunted the bug for a long time,
 but it's very simple. It's not GHC.

 You did not define `state` for `Wrapper`. That's not bad, since the
 documentation in mtl-2.1 states that minimal definition is `get`/`put`.
 The default definition for `state` is:

 {{{
     state f = do
       s <- get
       let ~(a, s) = f s
       put s
       return a
 }}}

 but in transformers-0.3 you can find:

 {{{
 instance (Monad m) => Monad (StateT s m) where
     return a = state $ \s -> (a, s)
     [...]
 }}}

 so `state` and `return` are mutually calling themselves, and `state` in
 second code should be `StateT`. Bug in transformers. I reopened the ticket
 as I am unsure where to report this...

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