[Haskell-cafe] Set of reals...?

Keith Wansbrough Keith.Wansbrough at cl.cam.ac.uk
Fri Oct 29 08:42:15 EDT 2004


> >Keith Wansbrough wrote:
> 
> >>Which brings me to a question: is there a better way to write -inf and
> >>+inf in Haskell than "-1/0" and "1/0"?
> 
> Why not do it with types:
> 
> 	data InfDbl = Dbl Double | PositiveInfinity | NegativeInfinity

?

Double already has +Inf and -Inf; it's just that Haskell doesn't have 
(AFAIK) syntax to write them as constants.

--KW 8-)
-- 
Keith Wansbrough <kw217 at cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.



More information about the Haskell-Cafe mailing list