[Haskell-cafe] The evil GADTs extension in ghci 7.8.4 (maybe in other versions too?)

Ben Franksen ben.franksen at online.de
Sun Jul 19 21:29:51 UTC 2015


wren romano wrote:
> On Wed, Jun 10, 2015 at 3:21 PM, Nathan Bouscal <nbouscal at gmail.com>
> wrote:
>>> The current behavior may be surprising if you are not aware of it, but
>>> it's the only sensible one. Otherwise, what should the meaning of
>>>
>>> {-# LANGUAGE MonoLocalBinds, NoMonoLocalBinds #-}
>>>
>>> be?
>>
>> Arguably it should be a compiler warning.
> 
> +1.
> 
> I'd say, when a set of flags are mutually incompatible (e.g., {Foo,
> NoFoo}) then that should be a warning/error. Whereas with GADTs, we
> *recommend* (and by default assume) MonoLocalBinds, but GADTs are not
> *incompatible* with NoMonoLocalBinds. We already support defeasible
> recommendations (in practice, if not intentionally); why not remove
> the counterintuitive corner cases they create in the current
> implementation?
> 
> As for the complaint about project-wide vs file-specific language
> extensions: yes, it can be helpful to have overriding behavior; but
> having that behavior at the commandline or within a single file is
> counterintuitive at best. What I think would make more sense is a
> set-valued variant of the Last monad where each local collection of
> constraints (the collection given on the commandline, the collection
> given in the cabal file, the collection given in the Haskell file
> itself, etc) must be internally consistent, generating an
> error/warning if it is not. And then we simply have the more
> fine-grained constraint sets override the coarser-grained constraint
> sets.

This is exactly the conclusion I arrived at when re-designing the option 
handling in Darcs. There we have even more (four) sources for options; in 
decreasing order of precedence: hard-coded defaults, global (per user) 
defaults, local (per repo) defaults, command line. Each level is required to 
be consistent in itself, later levels override earlier ones. Experience with 
this scheme has been good so far.

Cheers
Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams




More information about the Haskell-Cafe mailing list