[GHC] #1449: Bug in instance MonadFix []

GHC trac at galois.com
Thu Jun 21 21:02:23 EDT 2007


#1449: Bug in instance MonadFix []
-----------------------------------+----------------------------------------
    Reporter:  oerjan at nvg.ntnu.no  |        Owner:                        
        Type:  bug                 |       Status:  closed                
    Priority:  normal              |    Milestone:                        
   Component:  libraries/base      |      Version:  6.6.1                 
    Severity:  normal              |   Resolution:  invalid               
    Keywords:                      |   Difficulty:  Unknown               
          Os:  Unknown             |     Testcase:  mfix (([1,2]++).(:[]))
Architecture:  Unknown             |  
-----------------------------------+----------------------------------------
Changes (by ross):

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

Comment:

 `mfix` is intended to be ''value recursion'', where the values are fed
 back, not the monadic computation (in this case the outer list).  This is
 enforced by the `mfix` laws, which are reproduced in the documentation of
 `MonadFix`. The proposed definition violates at least the purity and left
 sliding laws, as the following expected equations do not hold:
 {{{
 mfix (return . const 1)  =  return (fix (const 1))
 mfix (\x -> [1,2] >>= \y -> [y,3])  =  [1,2] >>= \y -> mfix (\x -> [y,3])
 }}}
 Value recursion on the list monad isn't very useful; here's an example:
 {{{
 mfix (\xs -> [take 3 (1:xs), take 4 (2:xs)])
 }}}
 For much more detail, see Levent Erkok's thesis ''Value Recursion in
 Monadic Computations'' (from which the above examples were taken).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1449>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list