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

Iavor Diatchki iavor.diatchki at gmail.com
Tue Jul 24 16:23:28 UTC 2018


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/f758463b/attachment.html>


More information about the ghc-steering-committee mailing list