[ghc-steering-committee] Discussion on "Allow ScopedTypeVariables to refer to types" (#128)

Simon Peyton Jones simonpj at microsoft.com
Tue Jul 24 16:25:39 UTC 2018


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









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20180724/83bd8130/attachment.html>


More information about the ghc-steering-committee mailing list