
26 May
2007
26 May
'07
8 p.m.
Dominic Steinitz wrote:
I would expect
foo r@(Range BITSTRING _ _) x = []
to give an error but it doesn't. Writing
t = Range BITSTRING
gives one so why not the pattern match?
AFAICS, this is because when you construct a value, as in t, you have to provide the required context (Ord in this case) or face an error. OTOH, when you destruct a value, you simply get the context back and you are not required to provide anything, so no type error is generated. This works in HEAD: data A data Foo where F :: Num A => Foo bar :: Foo -> A bar F = 42 Regards, Zun.