Changes between Version 14 and Version 15 of NewtypeWrappers


Ignore:
Timestamp:
Jul 27, 2013 10:24:18 AM (9 months ago)
Author:
nomeata
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewtypeWrappers

    v14 v15  
    151151* Check for constructor visibility. ✓ 
    152152* Check for data constructor argument convertibility. ✓ (but not very elegant yet) 
     153* Make `IncoherentInstances` [http://www.haskell.org/pipermail/ghc-devs/2013-July/001771.html even more incoherent]. 
    153154* Think about higher-order type arguments. 
    154155* Polish error messages. 
     
    159160 
    160161* The deriving code works in the typechecker and has to generate `HsExpr`, but the implementation is only possible in Core. Currently, a dummy value is inserted by the deriving code and later implemented by a core-to-core pass. Better solution: Add a `HsCore` data constructor to `HsExpr`, similar to `HsCoreTy` in `HsType`? 
    161 * The overlapping nature of the problem. We clearly want to have a base case `IsNT a a` so that `castNT :: (Int,a) -> (Age, a)` is possible. For that we need all instances of `IsNT` to have the incoherent flag set (✓). But that is not enough: `castNT :: (Int,[a]) -> (Age, [a])` does not work (overlapping matching instances `IsNT a a` and `IsNT [a] [a]`), while  (counterintuitively) `(castNT :: (Int,a) -> (Age, a)) :: (Int,[a]) -> (Age, [a])` works again. Possible solutions: 
    162  * Change the semantics of `IncoherentInstances` that it chooses an arbitrary, or the most specific, or the most general instance here. 
    163  * Add a flag to classes that marks them as “univalent”, telling the type checker that any instance is good and overlap should not hinder him 
    164162 
    165163Code not yet pushed anywhere.