2009/10/9 wren ng thornton :
> Cristiano Paris wrote:
>>
>> On Thu, Oct 8, 2009 at 12:48 PM, Lennart Augustsson wrote:
>>>
>>> The reason a gets a single type is the monomorphism restriction (read
>>> the report).
>>> Using NoMonomorphismRestriction your example with a works fine.
>>
>> Could you e
Cristiano Paris wrote:
On Thu, Oct 8, 2009 at 12:48 PM, Lennart Augustsson wrote:
The reason a gets a single type is the monomorphism restriction (read
the report).
Using NoMonomorphismRestriction your example with a works fine.
Could you explain why, under NoMonomorphismRestriction, this type
Indeed, the types
foo :: forall a . (Num a) => a -> (Int, Float)
and
foo :: (forall a . (Num a) => a) -> (Int, Float)
are quite different.
The first one say, I (foo) can handle any kind of numeric 'a' you (the
caller) can pick. You (the caller) get to choose exactly what type you
give me.
The
Hello Cristiano,
Thursday, October 8, 2009, 7:14:20 PM, you wrote:
> Could you explain why, under NoMonomorphismRestriction, this typechecks:
> let a = 1 in (a + (1 :: Int),a + (1 :: Float))
> while this not:
> foo :: Num a => a -> (Int,Float)
> foo k = (k + (1 :: Int), k + (1.0 :: Float))
i
2009/10/8 Cristiano Paris :
> On Thu, Oct 8, 2009 at 12:48 PM, Lennart Augustsson
> wrote:
>> The reason a gets a single type is the monomorphism restriction (read
>> the report).
>> Using NoMonomorphismRestriction your example with a works fine.
>
> Could you explain why, under NoMonomorphismRest
On Thu, Oct 8, 2009 at 12:48 PM, Lennart Augustsson
wrote:
> The reason a gets a single type is the monomorphism restriction (read
> the report).
> Using NoMonomorphismRestriction your example with a works fine.
Could you explain why, under NoMonomorphismRestriction, this typechecks:
let a = 1 i
Thanks all!
Thu
2009/10/8 Lennart Augustsson :
> The reason a gets a single type is the monomorphism restriction (read
> the report).
> Using NoMonomorphismRestriction your example with a works fine.
>
> On Thu, Oct 8, 2009 at 12:29 PM, Cristiano Paris wrote:
>> On Thu, Oct 8, 2009 at 11:04 AM, m
The reason a gets a single type is the monomorphism restriction (read
the report).
Using NoMonomorphismRestriction your example with a works fine.
On Thu, Oct 8, 2009 at 12:29 PM, Cristiano Paris wrote:
> On Thu, Oct 8, 2009 at 11:04 AM, minh thu wrote:
>> Hi,
>>
>> I'd like to know what are the
2009/10/8 Cristiano Paris :
> On Thu, Oct 8, 2009 at 11:04 AM, minh thu wrote:
>> Hi,
>>
>> I'd like to know what are the typing rules used in Haskell (98 is ok).
>>
>> Specifically, I'd like to know what makes
>>
>> let i = \x -> x in (i True, i 1)
>>
>> legal, and not
>>
>> let a = 1 in (a + (1
On Thu, Oct 8, 2009 at 11:04 AM, minh thu wrote:
> Hi,
>
> I'd like to know what are the typing rules used in Haskell (98 is ok).
>
> Specifically, I'd like to know what makes
>
> let i = \x -> x in (i True, i 1)
>
> legal, and not
>
> let a = 1 in (a + (1 :: Int), a + (1.0 :: Float))
>
> Is it co
2009/10/8 Jochem Berndsen :
> minh thu wrote:
>> Also, I'd like to know why
>>
>> id id True
>>
>> is permitted but not
>>
>> (\f -> f f True) id
>
> If you want to do this, answer the question "what is the type of (\f ->
> f f True)"?
> You can do this, by the way, using rank-2 types:
>> {-# LANGU
minh thu wrote:
> Also, I'd like to know why
>
> id id True
>
> is permitted but not
>
> (\f -> f f True) id
If you want to do this, answer the question "what is the type of (\f ->
f f True)"?
You can do this, by the way, using rank-2 types:
> {-# LANGUAGE Rank2Types, PatternSignatures #-}
> thisI
minh thu wrote:
Also, I'd like to know why
id id True
is permitted but not
(\f -> f f True) id
Because this requires rank-2 types:
Prelude> :set -XScopedTypeVariables
Prelude> :set -XRank2Types
Prelude> (\(f :: forall a. a -> a) -> f f True) id
True
HTH,
Martijn.
__
Hi,
I'd like to know what are the typing rules used in Haskell (98 is ok).
Specifically, I'd like to know what makes
let i = \x -> x in (i True, i 1)
legal, and not
let a = 1 in (a + (1 :: Int), a + (1.0 :: Float))
Is it correct that polymorphic functions can be used polymorphically
(in multi
14 matches
Mail list logo