diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2013-08-02 15:47:03 +0100 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2013-08-02 15:47:03 +0100 |
commit | e8aa8ccba0c40884765281b21ff8f4411802dd41 (patch) | |
tree | e29e041226a8cb34a1aeca77f824b22db5a9be0f /compiler/prelude/PrelRules.lhs | |
parent | 303d3de9b52f67b9234f94d0e77e0933ca572ce7 (diff) | |
download | haskell-e8aa8ccba0c40884765281b21ff8f4411802dd41.tar.gz |
Implement "roles" into GHC.
Roles are a solution to the GeneralizedNewtypeDeriving type-safety
problem.
Roles were first described in the "Generative type abstraction" paper,
by Stephanie Weirich, Dimitrios Vytiniotis, Simon PJ, and Steve Zdancewic.
The implementation is a little different than that paper. For a quick
primer, check out Note [Roles] in Coercion. Also see
http://ghc.haskell.org/trac/ghc/wiki/Roles
and
http://ghc.haskell.org/trac/ghc/wiki/RolesImplementation
For a more formal treatment, check out docs/core-spec/core-spec.pdf.
This fixes Trac #1496, #4846, #7148.
Diffstat (limited to 'compiler/prelude/PrelRules.lhs')
-rw-r--r-- | compiler/prelude/PrelRules.lhs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/prelude/PrelRules.lhs b/compiler/prelude/PrelRules.lhs index b569840918..6faecaaef9 100644 --- a/compiler/prelude/PrelRules.lhs +++ b/compiler/prelude/PrelRules.lhs @@ -47,7 +47,7 @@ import BasicTypes import DynFlags import Platform import Util -import Coercion (mkUnbranchedAxInstCo,mkSymCo) +import Coercion (mkUnbranchedAxInstCo,mkSymCo,Role(..)) import Control.Monad import Data.Bits as Bits @@ -1020,7 +1020,7 @@ match_magicSingI (Type t : e : Lam b _ : _) , Just (sI_tc,xs) <- splitTyConApp_maybe sI_type , Just (_,_,co) <- unwrapNewTyCon_maybe sI_tc = Just $ let f = setVarType b fu - in Lam f $ Var f `App` Cast e (mkSymCo (mkUnbranchedAxInstCo co xs)) + in Lam f $ Var f `App` Cast e (mkSymCo (mkUnbranchedAxInstCo Representational co xs)) match_magicSingI _ = Nothing |