
1 Feb
2011
1 Feb
'11
4:52 a.m.
On 27 January 2011 17:11, Iavor Diatchki
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