On 27 January 2011 17:11, Iavor Diatchki <[email protected]> wrote:
> instance Num Wrapped where
> local
> lift2 f (Wrapped a) (Wrapped b) = Wrapped (f a b)
> lift f (Wrapped a) = Wrapped (f a)
> in
> (+) = lift2 (+)
> (-) = lift2 (-)
> (*) = lift2 (*)
> abs = lift abs
> signum = lift signum
Local declarations at module scope can be emulated using pattern bindings:
"""
(foo, bar) = (foo, bar)
where
foo = ..
bar = ..
private = ...
"""
If instance declarations supported pattern bindings you could get the
same effect for your instances too. This would be a minimal change
that avoided introducing any extra syntax.
Cheers,
Max
_______________________________________________
Haskell-prime mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-prime