[Haskell-cafe] ghc -e

Tony Morris tonymorris at gmail.com
Wed Jan 6 19:35:16 EST 2010


Gwern Branwen wrote:
> On Wed, Jan 6, 2010 at 7:23 PM, Tony Morris <tonymorris at gmail.com> wrote:
>   
>> ghc -e "import Control.Monad; forM [[1,2,3]] reverse"
>>     
>
> As of 6.10.2, the bug whereby the GHC API lets you use functions from
> anywhere just by naming them (Java-style) has not been fixed:
>
> $ ghc -e "Control.Monad.forM [[1,2,3]] reverse"
> package flags have changed, resetting and loading new packages...
>
> <interactive>:1:25:
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Num t' arising from the literal `3' at <interactive>:1:25
>     In the expression: 3
>     In the expression: [1, 2, 3]
>     In the first argument of `forM', namely `[[1, 2, 3]]'
>
> <interactive>:1:25:
>     Warning: Defaulting the following constraint(s) to type `Integer'
>              `Num t' arising from the literal `3' at <interactive>:1:25
>     In the expression: 3
>     In the expression: [1, 2, 3]
>     In the first argument of `forM', namely `[[1, 2, 3]]'
> [[3],[2],[1]]
> it :: [[Integer]]
> (0.01 secs, 1710984 bytes)
>
>   
I see the same on GHC 6.10.4.
$ ghc -e "Control.Monad.forM [[1,2,3]] reverse"
[[3],[2],[1]]


What would it be fixed to? What is wrong with how it is?

-- 
Tony Morris
http://tmorris.net/




More information about the Haskell-Cafe mailing list