[Haskell-cafe] Typeclass problem

Mark T.B. Carroll Mark.Carroll at Aetion.com
Thu Jul 29 14:17:53 EDT 2004

On Thu, 29 Jul 2004, Bjorn Bringert wrote:
> 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

More information about the Haskell-Cafe mailing list