import Text.ParserCombinators.Parsec
data PermParser tok st a = Perm (Maybe a) [Branch tok st a]
data Branch tok st a = forall b. Branch (PermParser tok st (b -> a))
(GenParser tok st b)
I have hoogled the `forall` but i cannot find any appropriate answer!
thanks!
-
fac n = foldr (*)
Forall means the same thing as it means in math, it means "for any
type -- call it `b` -- then the type of the following it `Branch
(PermParser tok st (b -> a)`"
`tok`, `st` and `a` are all given by the declaration of the datatype
itself.
Hope that makes sense,
/Joe
On Nov 11, 2009, at
On Wed, Nov 11, 2009 at 4:24 PM, zaxis wrote:
> data Branch tok st a = forall b. Branch (PermParser tok st (b -> a))
> (GenParser tok st b)
>
> I have hoogled the `forall` but i cannot find any appropriate answer!
That's an example of an existential type. What that line is saying is
that for
Without `forall`, the ghci will complain: "Not in scope: type variable `b' "
It is clear now. thank you!
Dan Piponi-2 wrote:
>
> On Wed, Nov 11, 2009 at 4:24 PM, zaxis wrote:
>> data Branch tok st a = forall b. Branch (PermParser tok st (b -> a))
>> (GenParser tok st b)
>>
>> I have hoogle
Dan Piponi wrote:
To use these types with ghc you need to use the compilation flag
-XExistentialQuantification.
Or, more portably, add {-# LANGUAGE ExistentialQuantification #-} at the
top of the source file. It should now compile in any computer that
supports this feature without any spec
Joe Fredette wrote:
Forall means the same thing as it means in math
...which not everybody already knows about. ;-)
Even I am still not 100% sure how placing forall in different positions
does different things. But usually it's not something I need to worry
about. :-)
_
2009/11/12 Andrew Coppin :
> Joe Fredette wrote:
>>
>> Forall means the same thing as it means in math
>
> ...which not everybody already knows about. ;-)
>
> Even I am still not 100% sure how placing forall in different positions does
> different things. But usually it's not something I need to wo
Eugene Kirpichov wrote:
2009/11/12 Andrew Coppin :
Even I am still not 100% sure how placing forall in different positions does
different things. But usually it's not something I need to worry about. :-)
To me it does not look like it does different things: everywhere it
denotes univer
2009/11/12 Neil Brown :
> Eugene Kirpichov wrote:
>>
>> 2009/11/12 Andrew Coppin :
>>
>>>
>>> Even I am still not 100% sure how placing forall in different positions
>>> does
>>> different things. But usually it's not something I need to worry about.
>>> :-)
>>>
>>
>> To me it does not look like it
On Thu, Nov 12, 2009 at 2:50 AM, Eugene Kirpichov wrote:
> But that's not an issue of semantics of forall, just of which part of
> the rather broad and universal semantics is captured by which language
> extensions.
The forall for existential type quantification is wierd.
> data Top = forall a.
Eugene Kirpichov wrote:
2009/11/12 Andrew Coppin :
Joe Fredette wrote:
Forall means the same thing as it means in math
...which not everybody already knows about. ;-)
Even I am still not 100% sure how placing forall in different positions does
different things. But usually it's
2009/11/12 Ryan Ingram :
> On Thu, Nov 12, 2009 at 2:50 AM, Eugene Kirpichov
> wrote:
>> But that's not an issue of semantics of forall, just of which part of
>> the rather broad and universal semantics is captured by which language
>> extensions.
>
> The forall for existential type quantificatio
On Thu, Nov 12, 2009 at 8:52 PM, Andrew Coppin
wrote:
> I just meant it's not immediately clear how
> foo :: forall x. (x -> x -> y)
> is different from
> foo :: (forall x. x -> x) -> y
> It takes a bit of getting used to.
That still confuses me.
David Virebayre wrote:
On Thu, Nov 12, 2009 at 8:52 PM, Andrew Coppin
wrote:
I just meant it's not immediately clear how
foo :: forall x. (x -> x -> y)
is different from
foo :: (forall x. x -> x) -> y
It takes a bit of getting used to.
Tha
Andrew Coppin wrote:
>
> I just meant it's not immediately clear how
>
> foo :: forall x. (x -> x -> y)
>
> is different from
>
> foo :: (forall x. x -> x) -> y
Uhm, I guess you meant
foo :: forall x. ((x -> x) -> y)
VS.
foo :: (forall x. x -> x) -> y
, didn't you?
__
> I just meant it's not immediately clear how
>
> foo :: forall x. (x -> x -> y)
>
> is different from
>
> foo :: (forall x. x -> x) -> y
>
> It takes a bit of getting used to.
Those are different functions all together, so perhaps you meant these.
foo :: forall x y. (x -> x) -> y
bar :: fo
On Nov 12, 2009, at 2:59 PM, Sean Leather wrote:
> foo :: forall x y. (x -> x) -> y
> bar :: forall y. (forall x . x -> x) -> y
>
> While neither function is seemingly useful, the second says that the
> higher-order argument must be polymorphic. I see two options:
AHA! This is the bit of ins
Of the two declarations
>data Fizzle a = Fizzle (b -> (a, b)) a
>data Fizzle a = forall b. Fizzle (b -> (a, b)) a
only the second one is allowed (with some suitable extension).
Personally I think the first one should be allowed as well, with the
same meaning as the second one.
Some
On Sun, Nov 15, 2009 at 01:14:34AM +, Lennart Augustsson wrote:
> Of the two declarations
> >data Fizzle a = Fizzle (b -> (a, b)) a
> >data Fizzle a = forall b. Fizzle (b -> (a, b)) a
> only the second one is allowed (with some suitable extension).
>
> Personally I think the fir
On Sat, Nov 14, 2009 at 17:55, Mark Lentczner wrote:
> Would I be correct in thinking: The difference between these two is that
> the type b can be "fixed" upon application of amy to the first two arguments
> (given context), whereas bob applied to two arguments MUST return a function
> that is ap
Mark Lentczner wrote:
I also think I understand that the implicit 'forall' inherent in Haskell falls
at different places in various constructs, which also had me confused. For
example, while the above two function type declarations are equivalent, these
two data declarations aren't:
d
21 matches
Mail list logo