[Haskell-cafe] Type Theory? Relations
haskell at alias.spaceandtime.org
haskell at alias.spaceandtime.org
Mon Jul 26 13:46:29 EDT 2004
Hello,
I have a question that may pertain to type theory.
According to Enderton, one of the ways to define an ordered pair (a,b)
is {{a},{a,b}}. A relation is defined as a set of ordered-pairs. A
map, of course, is a single-valued relation.
Given all that, suppose I have a "FiniteMap Int String" in Haskell.
This is, according to the definitions above, a "Set (Int,String)". An
element of that has type (Int,String), which contains {Int,String}. But
that can't exist because a Set contains only elements of one type.
What I'm getting at is that it seems that a Relation should be defined
type Relation a = Set (a,a)
rather than
type Relation a b = Set (a,b)
so that we don't have this problem.
Thanks.
More information about the Haskell-Cafe
mailing list