[Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1 ?

David Menendez dave at zednenem.com
Fri Mar 26 20:56:31 EDT 2010


On Fri, Mar 26, 2010 at 8:20 PM, zaxis <z_axis at 163.com> wrote:
>
> In 6.12.1 under archlinux
>>let f x y z = x + y + z
>> :t f
> f :: (Num a) => a -> a -> a -> a
>
>> :t (>>=) . f
> (>>=) . f :: (Num a) => a -> ((a -> a) -> a -> b) -> a -> b
>> ((>>=) . f) 1 (\f x -> f x) 2
> 5
>
> In 6.10.4_1 under freebsd
>> let f x y z = x + y + z
> *Money> :t f
> f :: (Num a) => a -> a -> a -> a
>
>> :t (>>=) . f
> (>>=) . f  :: (Monad ((->) a), Num a) => a -> ((a -> a) -> a -> b) -> a -> b
>> ((>>=) . f) 1 (\f x -> f x) 2
>
> <interactive>:1:1:
>    No instance for (Monad ((->) a))
>      arising from a use of `>>=' at <interactive>:1:1-5
>    Possible fix: add an instance declaration for (Monad ((->) a))
>    In the first argument of `(.)', namely `(>>=)'
>    In the expression: ((>>=) . f) 1 (\ f x -> f x) 2
>    In the definition of `it': it = ((>>=) . f) 1 (\ f x -> f x) 2

It looks like you have the instance Monad ((->) a) loaded in 6.12, but
not in 6.10.4. In don't know of any changes regarding that instance in
6.12, but instances stick around in ghci even after their module is
unloaded, so you might have (indirectly) loaded
Control.Monad.Instances at some point in your 6.12 session.

Try starting a fresh ghci 6.12 and see what that does.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>


More information about the Haskell-Cafe mailing list