Hi,

if you desugar the definition that's causing the type error,
perhaps it becomes a little bit clearer what's going on, i.e.,
from

problematic :: MyAnnotatedType Int
problematic = defaultVal{theInt=42,theAnnotation=10}

you expand this to

problematic' = case defaultVal of { MAT a b c -> MAT 42 b 10 }

Clearly, the type of 'c' is ambiguous here. Interestingly, if Haskell 98
had defined record update expr "e{fields}" as having the same type
as "e", this wouldn't have been an issue:

no_probs =
case defaultVal of { m@(MAT a b c) -> (MAT 42 b 10) `asTypeOf` m}

hth
--sigbjorn

----- Original Message ----- From: "Magnus Björk" <[EMAIL PROTECTED]>
To: <glasgow-haskell-bugs@haskell.org>; <hugs-bugs@haskell.org>
Sent: Monday, May 29, 2006 03:34
Subject: Strange behaviour with classes (both Hugs and GHC)


I just ran into a strange behaviour of both Hugs and GHC. I discussed it
with John Hughes who managed to find a workaround, and suggested that I
ask you whether this is really expected behaviour.

The attached file contains a small example that exhibits the problem.

--
/MpB


--------------------------------------------------------------------------------


_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to