[ghc-steering-committee] Discussion on "Allow ScopedTypeVariables to refer to types" (#128)
Richard Eisenberg
rae at cs.brynmawr.edu
Tue Jul 24 19:01:31 UTC 2018
Unsurprisingly, I'm in support. The lack of this ability has forced `singletons` to go through hoops to bind type variables in certain situations.
> On Jul 24, 2018, at 12:25 PM, Simon Peyton Jones via ghc-steering-committee <ghc-steering-committee at haskell.org> wrote:
>
> I originally thought that it’d be confusing for ‘a’ to mean ‘Bool’; but that was before GADTs! Now that argument is much less strong, and I’m in favour of this proposal.
>
> Simon
>
> From: ghc-steering-committee <ghc-steering-committee-bounces at haskell.org> On Behalf Of Iavor Diatchki
> Sent: 24 July 2018 17:23
> To: ghc-steering-committee at haskell.org
> Subject: [ghc-steering-committee] Discussion on "Allow ScopedTypeVariables to refer to types" (#128)
>
> Hello,
>
>
>
> let's get the discussion going on proposal #128.
>
>
>
> Summary: this proposal generalizes the behavior of type variables in patterns, specifically the variables that do not refer to an explicitly quantified type parameter. The idea is that such type variables simply introduce a name for their matching type, without placing any restriction on the type. For example, consider the following definition.
>
>
>
> f (x : [a]) (y : a) = and x
>
>
>
> This would be accepted and it would have type `[Bool] -> Bool -> Bool`. This proposal is about the meaning of the type signature on `x` which states that it must be a list of something, and `a` will be a name for the type of its elements. In this case, it happens that `a` is actually just an alias for `Bool`.
>
>
>
> I am strongly in favor of this proposal. As I mentioned on the github discussion, I thought that the feature already worked as in this proposal, and was quite surprised to find out that currently, GHC has restrictions on what `a` could be, and it also complains about "multiple definitions for `a`" in the above example).
>
>
>
> Thoughts?
>
>
>
> -Iavor
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ghc-steering-committee mailing list
> ghc-steering-committee at haskell.org
> https://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-steering-committee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20180724/9ef00d03/attachment-0001.html>
More information about the ghc-steering-committee
mailing list