[Haskell-cafe] using type variables in type declarations inside function
allbery.b at gmail.com
Thu Apr 12 20:26:50 UTC 2018
I don't know Purescript so couldn't say about that. In standard Haskell you
don't need to use forall at all; it's used by this extension and by
extensions for existential types.
On Thu, Apr 12, 2018 at 4:24 PM, Dennis Raddle <dennis.raddle at gmail.com>
> By the way, why do I sometimes have to use forall, and sometimes not?
> I'm also learning Purescript, and I noticed that the examples use 'forall'
> in every case. Why would it be different with Purescript?
> On Thu, Apr 12, 2018 at 12:51 PM, Brandon Allbery <allbery.b at gmail.com>
>> On Thu, Apr 12, 2018 at 3:47 PM, Dennis Raddle <dennis.raddle at gmail.com>
>>> myFunc :: a -> b -> c
>>> myFunc x y z = ...
>>> helper :: a -> [b]
>>> helper xx = ...
>>> Notice that I'm attempting to declare 'helper' using my type variables.
>>> I've noticed that this results in an error.
>>> Is this actually possible, and how?
>> You need the ScopedTypeVariables extension, *and* to "declare" the type
>> variables whose scope is to be extended with an explicit "forall" in the
>> brandon s allbery kf8nh sine nomine
>> allbery.b at gmail.com
>> ballbery at sinenomine.net
>> unix, openafs, kerberos, infrastructure, xmonad
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe