[Haskell-cafe] Data types and Haskell classes

Tomasz Zielonka tomasz.zielonka at gmail.com
Mon May 16 16:42:18 EDT 2005


On Mon, May 16, 2005 at 09:26:07PM +0200, Jens Blanck wrote:
> How would I introduce number classes that are extended with plus and
> minus infinity? I'd like to have polymorphism over these new classes,
> something like a signature
> 
> f :: (Real a, Extended a b) => b -> b
> 
> which clearly is not part of the current syntax, but I hope you get
> the picture. What are the elegant ways of doing this?

How about
    f :: Real a => Extended a -> Extended a

Double and Float already include -Infinity and +Infinity:

Prelude> -(1/0) :: Double
-Infinity

Best regards
Tomasz


More information about the Haskell-Cafe mailing list