[Haskell-cafe] Ord for partially ordered sets

Barak A. Pearlmutter barak at cs.nuim.ie
Fri Apr 24 20:22:38 UTC 2015


> I'm confused.  What is supposed to be the result of `g1 <= g2` when `g1` and
> `g2` are not comparable according to the partial order?

Surely it would make things less confusing to simply follow existing
precedent already in the standard prelude?

$ ghci
Prelude> let nan=0/0::Double
Prelude> nan==nan
False
Prelude> compare 0 nan
GT
Prelude> compare nan 0
GT
Prelude> compare nan nan
GT
Prelude> 0<=nan
False
Prelude> nan<=0
False
Prelude> nan<=nan
False
Prelude> let infty=1/0::Double
Prelude> infty <= nan
False
Prelude> nan <= infty
False

Perhaps not.


More information about the Haskell-Cafe mailing list