[Haskell-cafe] instance Enum Double considered not entirely great?

Maciej Marcin Piechotka uzytkownik2 at gmail.com
Wed Sep 21 02:27:01 CEST 2011


On Wed, 2011-09-21 at 01:23 +0200, Daniel Fischer wrote:
> On Wednesday 21 September 2011, 00:38:12, Maciej Marcin Piechotka wrote:
> > +1 for:
> > 
> > class Eq a => IEEEEq a where
> >     (<.) :: a -> a -> Bool
> >     (>.) :: a -> a -> Bool
> > 
> > Regards
> 
> -1 for the class name, too easy to miscount the Es.
> 

s/for:/for something like/

> And perhaps it would be better to add the IEEE compliant(?) comparisons to 
> the RealFloat class.
> 
> class (RealFrac a, Floating a) => RealFloat a where
>     ...    -- lots of stuff we already have
>     (==.) :: a -> a -> Bool
>     (<.) :: a -> a -> Bool
>     ...
> 
> However, I don't particularly like adding just a dot, that's too easily 
> overlooked. On the other hand, I don't have a compelling idea either. 
> (.==.), (.<.) would at least double the chances to spot the difference.
> 
> Anyway, +1 for an Ord instance with a total order (consistent with the 
> natural order where applicable) and putting the IEEE comparisons somewhere 
> else.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110921/4975fc72/attachment.pgp>


More information about the Haskell-Cafe mailing list