Here's the difference between these two types: test1 :: forall a. a -> Int -- The caller of test1 determines the type for test1 test2 :: (forall a. a) -> Int -- The internals of test2 determines what type, or types, to instantiate the argument at Or, to put it another way, since there are no non-bottom objects of type (forall a. a): test1 converts *anything* to an Int. test2 converts *nothing* to an Int -- type-correct implementation -- instantiates the (forall a. a) argument at Int test2 x = x -- type error, the caller chose "a" and it is not necessarily Int -- test1 x = x -- type-correct implementation: ignore the argument test1 _ = 1 -- ryan On Wed, Sep 16, 2009 at 1:04 AM, Cristiano Paris <frodo@theshire.org> wrote:
On Tue, Sep 15, 2009 at 11:38 PM, Daniel Fischer <daniel.is.fischer@web.de> wrote:
...
foo :: forall a. a -> a
This is exactly the same type as
foo :: a -> a
(unless you're using ScopedTypeVariables and there's a type variable a in scope), since type signatures are implicitly forall'd.
Yep, perhaps I used the wrong example. What about foo: (forall a. a) -> Int?
Cristiano _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe