#4236: arrow bug
---------------------------------+------------------------------------------
    Reporter:  igloo             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:  6.14.1      
   Component:  Compiler          |      Version:  6.12.3      
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------
 Initially reported here: http://www.haskell.org/pipermail/glasgow-haskell-
 users/2010-July/019035.html

 This program:
 {{{
 {-# LANGUAGE Arrows #-}
 module Main where

 import Control.Arrow

 foo :: (b -> String) -> ((((b, Int), Float), Double) -> String) -> (b ->
 String)
 foo f g b = f b ++ " " ++ g (((b, 8), 1.0), 6.0)

 bar :: (t -> String) -> ((t, Double, Float, Int) -> String) -> t -> String
 bar f g  = proc x -> do
   (f -< x) `foo` \n m k -> g -< (x,n,m,k)

 main = do
   putStrLn $ foo show show 17
   putStrLn $ bar show show 17
   putStrLn $ foo show show 42
   putStrLn $ bar show show 42
 }}}
 produces the wrong output:
 {{{
 17 (((17,8),1.0),6.0)
 17 (17,4.0e-323,1.0,4618441417868443648)
 42 (((42,8),1.0),6.0)
 42 (42,4.0e-323,1.0,4618441417868443648)
 }}}
 Note that, e.g.,
 {{{
 *Main GHC.Exts GHC.Prim> D# (unsafeCoerce# 4618441417868443648#)
 6.0
 }}}

 `-dcore-lint` failes with multiple errors.

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