[Haskell-cafe] Re: Existencial quantification and polymorphic
datatypes
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Tue Jan 20 06:01:30 EST 2009
Mauricio <briqueabraque at yahoo.com> writes:
> I'm trying, without success, to understand the difference
> between existencial quantification and polymorphic
> datatypes.
Polymorphic types are universally quantified;
so id:: forall t. t -> t
means that id works for every type t. If haskell had a
symbol for existential quantification,
hid:: exists t. t -> t
would mean that hid only works on some type t, but it
doesn't say what it is (so you could only ever apply hid to
undefined.
> Can you give me a hint
Because being on the left of an arrow works something like
negation, a type like (exists t. t -> t) -> bool can be
written as forall t . (t -> t) -> bool
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2008-04-26)
More information about the Haskell-Cafe
mailing list