Skip to content

Add defaulting plugins

abarbu requested to merge abarbu/ghc:ambiguity-plugin into master

Adding defaulting plugins after the encouraging discussion on ghc-proposals: https://github.com/ghc-proposals/ghc-proposals/pull/396

Defaulting plugins expose the defaulting mechanism allowing plugins to propose new defaults. This is critical for large libraries like those used in ML that have many parameters and types that users don't want to constantly deal with. ML libraries create their own numeric types, in effect forcing users to deal with numeric Haskell without any defaulting, a very tedious experience.

A full description of the rationale and approach is here: https://github.com/abarbu/ghc-proposals/blob/master/proposals/0000-defaulting-plugins.rst

PS: I noticed that warnings used to say:

        ((2 <=? a0) ~ 'True) 
          arising from a use of ‘w’ at test-defaulting-plugin.hs:22:15

while they now say:

        (Data.Type.Ord.OrdCond (CmpNat 2 a0) 'True 'True 'False ~ 'True)
          arising from a use of ‘w’ at test-defaulting-plugin.hs:22:15

Am I doing something wrong? I tried importing Data.Type.Ord to no effect.

Edited by abarbu

Merge request reports