[Haskell-cafe] Weird behavior with arrow commands

Ross Paterson ross at soi.city.ac.uk
Sat Jul 24 07:45:27 EDT 2010


On Sat, Jul 24, 2010 at 01:10:56PM +0200, Jürgen Doser wrote:
> This seems to be a bug in ghc. First, let's fix bar to give the full
> three arguments (Int, Float, Double)  to g:
> 
> bar f g  = proc x -> do
>   (f -< x) `foo` (\n m k -> g -< (n,m,k))
> 
> ghc infers the type:
> 
> bar :: (t -> String) -> ((Double, Float, Int) -> String) -> t -> String
> 
> and we see that the argument order in the second argument to bar is
> reversed. But the arguments are still given to bar in the order (Int,
> Float, Double). For example, the 6.0 in foo is interpreted as an Int and
> outputs a 0 (the first 32 bits in such a small double are zeros).
> When one varies the numbers in foo, one can see the effects in bar. Can
> someone from GHC HQ confirm my understanding, or is this just not
> supposed to work with multiple arguments?

You're right: it's getting the argument order wrong, so -dcore-lint
fails on this example and all bets are off.  Definitely a bug.


More information about the Glasgow-haskell-users mailing list