Type equivalency 2
Thu, 6 Jun 2002 01:13:12 -0700
At 2002-06-06 00:40, 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"
Well F and (->) may both be type-constructors of kind (* -> * -> *), but
I think there the similarity ends. You may consider an F as holding an
'a' and a 'b', but a function holds a 'b' for every 'a'. It's quite
different, and F does not implement functions.
If you're wondering about the value constructor for a function, ask
yourself, what would you pass to it?
You could do this, though:
newtype F' a b = MkF' (a -> b)
type F'' = (->)
I think you'll find (->) is pretty much atomic. It's tempting to say a
function is constructed from a piece of code, but for a lazy language
pretty much any value might be represented by a piece of code...
Ashley Yakeley, Seattle WA