[Haskell-cafe] Why is it so different between 6.12.1 and
6.10.4_1 ?
zaxis
z_axis at 163.com
Sat Mar 27 02:31:39 EDT 2010
I just start ghci from shell and do nothing else. In fact, i really donot
know `Monad ((->) a) ` . Would you mind expplain it ?
Yusaku Hashimoto wrote:
>
> Did you import the module includes the instance of Monad ((->) e)
> somewhere in your code loaded in ghci?
>
> I tried this on a fresh ghci 6.12, but I got "No instance" error.
>
> -nwn
>
> On Sat, Mar 27, 2010 at 9:20 AM, 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
>>
>> Sincerely!
>>
>>
>> -----
>> fac n = let { f = foldr (*) 1 [1..n] } in f
>> --
>> View this message in context:
>> http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28049329.html
>> Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-----
fac n = let { f = foldr (*) 1 [1..n] } in f
--
View this message in context: http://old.nabble.com/Why-is-it-so-different-between-6.12.1-and-6.10.4_1---tp28049329p28050535.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
More information about the Haskell-Cafe
mailing list