Skip to content

arrow bug

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.

Trac metadata
Trac field Value
Version 6.12.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information