[Haskell-cafe] Why is it so different between 6.12.1 and 6.10.4_1
?
Ivan Lazar Miljenovic
ivan.miljenovic at gmail.com
Fri Mar 26 20:59:57 EDT 2010
zaxis <z_axis at 163.com> writes:
> 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
>
Some definitions and exports got changed, so in 6.12 the (-> a) Monad
instance is exported whereas in 6.10 it isn't.
> fac n = let { f = foldr (*) 1 [1..n] } in f
Why do you bother with the interior definition of f in there?
fac = product . enumFromTo 1
--
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com
More information about the Haskell-Cafe
mailing list