[Haskell-cafe] Function Precedence
Hans Aberg
haberg at math.su.se
Wed Apr 2 09:47:20 EDT 2008
On 2 Apr 2008, at 14:27, jerzy.karczmarczuk at info.unicaen.fr wrote:
>> It would be better to write a new Prelude. :-)
>
> Oh, yes, our common dream...
One may not need to write a wholly new Prelude, by something like:
module NewPrelude where
import Prelude hiding -- Num, (+).
class AdditiveSemiMonoid a where
(+) :: a -> a -> a
...
class (Eq a, Show a, AdditiveSemiMonoid a) => Num a where
(+) :: a -> a -> a
-- Stuff of Prelude using Num.
Then import NewPrelude instead, and
instance AdditiveSemiMonoid (a -> b) where
f + g = \x -> f(x) + g(x)
or something.
Hans
More information about the Haskell-Cafe
mailing list