[ghc-steering-committee] #216: Qualified Do again, recommendation: accept the alternative

Spiwack, Arnaud arnaud.spiwack at tweag.io
Tue May 5 08:32:25 UTC 2020

> 2. Error messages come up too.
> […]
>    So you’d either get maybe
>       You have qualified the do block in … with Foo.builder, but
>       Foo.builder is of type Foo.Builder and the record Builder
>       does not have a field named (>>).
>    vs.
>       You have qualified the do block in … with Foo, but the module
>       Foo does not export a value named (>>).

I want to stress that these, if they read as just as good English
sentences, don't mean the same thing. The former says: you are using a
construction, in your do notation, that your builder doesn't support. The
latter says: you haven't imported the module which export this
construction, which may or may not exist.

Let me make up an example. It is not the case in `base`, but let's imagine
that `MonadFail` ins in a different module than `Monad`, then would have to
import `Control.Monad.Fail` in addition to `Control.Monad` in order to be
able to use partial pattern matching. You may argue that it is bad API
design. Which would be fair, but it is hard to assume that such an event
can't occur, when designing the compiler.

Neither of these arguments refute your underlying preference for
> records (which I would absolutely share – if we didn't need this ad-hoc
> “fully settled” and odd “any type works as long as it has the right
> fields”).
> I think it boils down to whether the goal (records) justify the kludges
> (fully settled, a desugaring that looks up some constructor K withoutusing
> it).

It's also a question of whether one would consider these as kludgy.  Or
whether they sound rather natural to your ears. To me: rather natural,
evidently. To you, and most other members of the committee, as far as I
could gather, they seem to sound weird and somewhat repulsive.

> (Can someone maybe just make GetField work with polytypes? Then we
> woudn’t have any of this discussion, I guess.)

Cheers to that :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-steering-committee/attachments/20200505/3e953535/attachment.html>

More information about the ghc-steering-committee mailing list