Type equivalency 2
Thu, 06 Jun 2002 11:39:29 +0200
Cagdas Ozgenc wrote:
> >From the previous discussion it has been brought to my attention that there
> is no much difference between
> a -> b
> data F a b = Blank a b -- "-> probably has a blank value constructor"
> Therefore it should be trivial to define a label initialized to a function
> abstraction without using the -> type constructor. I mean
> fun :: F Int Int
> fun ? = ?
> now what do I write in place of 1st and 2nd question marks? Even if I can do
> this, how am I suppose to invoke fun so that it would yield an "Int" not a
> "F Int Int"?
The type constructor F and the type constructor (->) are quite different.
They have the same kind, but just as the type only tell you part of what a
is, thekind only tells you part of what a type is.
Very informally a value of type "F a b" means "I have an a and a b", whereas
as type "a -> b" means "if you give me an a I'll give you a b". So the
arrow "consumes" its first argument rather than produces it.
> Or maybe I should ask the following question: what would the "value
> constructor" of -> look like, theoretically?
Well, in Haskell it looks like "\ x -> e". It different from data type
in that it's a binding construct, but it's the thing that constructs objects in