[Haskell-cafe] Learn You a Haskell for Great Good - a few doubts
Daniel Fischer
daniel.is.fischer at googlemail.com
Fri Mar 4 23:03:42 CET 2011
On Friday 04 March 2011 22:33:20, Alexander Solla wrote:
> > Unfortunately, Haskell's tuples aren't quite products.[1]
>
> I'm not seeing this either. (A,B) is certainly the Cartesian product of
> A and B.
Not quite in Haskell, there
(A,B) = A×B \union {_|_}
_|_ and (_|_,b) are distinguishable.
(A,()) contains
- (a,()) for a in A
- (a, _|_) for a in A
- _|_
the three classes are distinguishable
case x of
(a,b) -> do
putStrLn "Bona fide tuple"
case b of
() -> putStrLn "With defined second component"
will produce different output for them.
In Haskell, |(A,B)| = |A|×|B| + 1 (and |()| = 2, () = { (), _|_ }),
and |(A,B,C)| = |A|×|B|×|C| + 1 etc.
So one would expect |(A)| = |A| + 1 by consistency for 1-tuples.
> In what sense are you using "product" here?
Set theoretic or more general, category theoretic, I presume.
> Is your complaint
> a continuation of your previous (implicit) line of thought regarding
> distinct bottoms?
I don't think distinguishing bottoms is the issue, but distinuishing bottom
from partially defined values.
More information about the Haskell-Cafe
mailing list