[ghc-steering-committee] A few more pleas

Richard Eisenberg rae at richarde.dev
Tue Dec 8 19:53:59 UTC 2020



> On Dec 8, 2020, at 4:32 AM, Joachim Breitner <mail at joachim-breitner.de> wrote:
> 
> Would you argue that it should not be included even _if_ we’d include
> GADTs and/or TypeFamilies? Or are you saying that MonoLocalBinds
> shouldn’t be in; GADTS/TypeFamilies are bad without MonoLocalBinds, and
> thus GADTs/TypeFamilies ought to be left out?

No. If we have GADTs and/or TypeFamilies, then we should absolutely have MonoLocalBinds -- GADTs and TypeFamilies are wonky without MonoLocalBinds. I'd prefer not to have any of them on by default.

> On Dec 8, 2020, at 10:36 AM, Eric Seidel <eric at seidel.io> wrote:

> Aha, so what you're saying is that with NamedWildCards but not PartialTypeSignatures, GHC will tell you what `_a` was solved for, but it won't accept the resulting program? I didn't realize that NamedWildCards did anything in the absence of PartialTypeSignatures, but I agree that this is better. I was already voting for NamedWildCards, but now I'm inclined to additionally vote against PartialTypeSignatures.

Exactly, yes. I am strongly against PartialTypeSignatures as an extension, as users should have to opt into accepting partially-written programs.

> 
> On Dec 8, 2020, at 11:59 AM, Iavor Diatchki <iavor.diatchki at gmail.com> wrote:
> 
> It seems odd to turn on an extension [NamedWildCards] that doesn't do anything, and it is entirely there to make *another* extension work better?   Wouldn't it be better to make `PartialTypeSignatures` imply `NamedWildCards`?

NamedWildCards *does* do something on its own -- it just doesn't accept new programs.

If we consider

> foo :: _a -> _a
> foo True = False
> foo False = True

Without NamedWildCards, we get

> Bug.hs:4:5: error:
>     • Couldn't match expected type ‘_a’ with actual type ‘Bool’
>       ‘_a’ is a rigid type variable bound by
>         the type signature for:
>           foo :: forall _a. _a -> _a
>         at Bug.hs:3:1-15
>     • In the pattern: True
>       In an equation for ‘foo’: foo True = False
>     • Relevant bindings include foo :: _a -> _a (bound at Bug.hs:4:1)

With NamedWildCards, we get

> Bug.hs:5:8: error:
>     • Found type wildcard ‘_a’ standing for ‘Bool’
>       To use the inferred type, enable PartialTypeSignatures
>     • In the type signature: foo :: _a -> _a

I think that prefixing a variable name with an underscore is a convenient, lightweight way of asking GHC to tell me what a type should be.

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20201208/e379091c/attachment-0001.html>


More information about the ghc-steering-committee mailing list