
29 Jul
2004
29 Jul
'04
6:17 p.m.
On Thu, 29 Jul 2004, Bjorn Bringert wrote: (snip)
You could use asTypeOf from the Prelude:
let foo = maxBound `asTypeOf` x
Ah. I should re-read the Prelude every couple of months. (-: Thanks!
Also, Hugs and GHC both support an extension which lets you put type annotations in patterns:
showThings (x::c) = let foo = maxBound :: c in (show x, show foo)
That's cool. Is it something that's likely to be in the next standard, then? Or does it make more sense to have the type variables in the function's type signature be in scope in the function definition itself? -- Mark