[Haskell-cafe] nice simple problem for someone struggling....

Miguel Mitrofanov miguelimo38 at yandex.ru
Fri Dec 21 13:11:35 EST 2007


> module Main where
>
>
>
> data SquareType numberType = Num numberType => SquareConstructor  
> numberType
>
>
>
> class ShapeInterface shape where
>
>       area :: Num numberType => shape->numberType
>
>
>
> data ShapeType = forall a. ShapeInterface a => ShapeType a
>
>
>
> instance (Num a) => ShapeInterface (SquareType a) where
>
>     area (SquareConstructor side) = side * side
>

Awesome! That's the first e-mail I see that looks good in HTML!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071221/7e5996cb/attachment.htm


More information about the Haskell-Cafe mailing list