Implement "roles" into GHC.
authorRichard Eisenberg <eir@cis.upenn.edu>
Fri, 2 Aug 2013 14:47:03 +0000 (15:47 +0100)
committerRichard Eisenberg <eir@cis.upenn.edu>
Fri, 2 Aug 2013 14:47:03 +0000 (15:47 +0100)
commite8aa8ccba0c40884765281b21ff8f4411802dd41
treee29e041226a8cb34a1aeca77f824b22db5a9be0f
parent303d3de9b52f67b9234f94d0e77e0933ca572ce7
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.
73 files changed:
compiler/basicTypes/DataCon.lhs
compiler/basicTypes/MkId.lhs
compiler/cmm/SMRep.lhs
compiler/coreSyn/CoreLint.lhs
compiler/coreSyn/CoreSubst.lhs
compiler/coreSyn/CoreUtils.lhs
compiler/coreSyn/ExternalCore.lhs
compiler/coreSyn/MkExternalCore.lhs
compiler/coreSyn/PprExternalCore.lhs
compiler/coreSyn/TrieMap.lhs
compiler/deSugar/DsBinds.lhs
compiler/deSugar/DsForeign.lhs
compiler/deSugar/DsMeta.hs
compiler/ghci/ByteCodeAsm.lhs
compiler/hsSyn/Convert.lhs
compiler/hsSyn/HsTypes.lhs
compiler/hsSyn/HsUtils.lhs
compiler/iface/BinIface.hs
compiler/iface/BuildTyCl.lhs
compiler/iface/IfaceSyn.lhs
compiler/iface/IfaceType.lhs
compiler/iface/MkIface.lhs
compiler/iface/TcIface.lhs
compiler/main/DynFlags.hs
compiler/parser/Lexer.x
compiler/parser/Parser.y.pp
compiler/parser/ParserCore.y
compiler/parser/RdrHsSyn.lhs
compiler/prelude/PrelNames.lhs
compiler/prelude/PrelRules.lhs
compiler/prelude/TysPrim.lhs
compiler/prelude/TysWiredIn.lhs
compiler/rename/RnTypes.lhs
compiler/simplCore/SimplUtils.lhs
compiler/specialise/Rules.lhs
compiler/specialise/SpecConstr.lhs
compiler/stranal/WwLib.lhs
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcEvidence.lhs
compiler/typecheck/TcForeign.lhs
compiler/typecheck/TcGenGenerics.lhs
compiler/typecheck/TcHsType.lhs
compiler/typecheck/TcInstDcls.lhs
compiler/typecheck/TcInteract.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcSplice.lhs
compiler/typecheck/TcTyClsDecls.lhs
compiler/typecheck/TcTyDecls.lhs
compiler/typecheck/TcType.lhs
compiler/types/Class.lhs
compiler/types/CoAxiom.lhs
compiler/types/Coercion.lhs
compiler/types/FamInstEnv.lhs
compiler/types/OptCoercion.lhs
compiler/types/TyCon.lhs
compiler/types/Type.lhs
compiler/types/TypeRep.lhs
compiler/utils/Maybes.lhs
compiler/utils/UniqFM.lhs
compiler/utils/Util.lhs
compiler/vectorise/Vectorise/Generic/PAMethods.hs
compiler/vectorise/Vectorise/Generic/PData.hs
compiler/vectorise/Vectorise/Type/Env.hs
compiler/vectorise/Vectorise/Type/TyConDecl.hs
compiler/vectorise/Vectorise/Utils/Base.hs
compiler/vectorise/Vectorise/Utils/PADict.hs
docs/core-spec/CoreLint.ott
docs/core-spec/CoreSyn.ott
docs/core-spec/OpSem.ott
docs/core-spec/README
docs/core-spec/core-spec.mng
docs/core-spec/core-spec.pdf
docs/users_guide/glasgow_exts.xml