diff options
author | Gabor Greif <ggreif@gmail.com> | 2015-08-01 10:52:39 +0200 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2015-08-01 10:52:39 +0200 |
commit | a8754a40132f7e59d4e0e166fc8ad4ef96b95aab (patch) | |
tree | 52e7b669bb7f9f8b10f6d333aa27bd6d45b21793 | |
parent | a442800fd27952bff9bf9773f514ee062f4b55d0 (diff) | |
download | haskell-wip/branchedness.tar.gz |
Make BranchFlag a new kind, resolving an old TODO commentwip/branchedness
-rw-r--r-- | compiler/types/CoAxiom.hs | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/compiler/types/CoAxiom.hs b/compiler/types/CoAxiom.hs index cd8607a4bb..36d9a6722f 100644 --- a/compiler/types/CoAxiom.hs +++ b/compiler/types/CoAxiom.hs @@ -1,6 +1,6 @@ -- (c) The University of Glasgow 2012 -{-# LANGUAGE CPP, DeriveDataTypeable, GADTs, ScopedTypeVariables #-} +{-# LANGUAGE CPP, DataKinds, DeriveDataTypeable, GADTs, KindSignatures, ScopedTypeVariables, StandaloneDeriving #-} -- | Module for coercion axioms, used to represent type family instances -- and newtypes @@ -108,13 +108,6 @@ declaring whether it is known to be a singleton or not. The list of branches is stored using a special form of list, declared below, that ensures that the type variable is accurate. -As of this writing (Dec 2012), it would not be appropriate to use a promoted -type as the phantom type, so we use empty datatypes. We wish to have GHC -remain compilable with GHC 7.2.1. If you are revising this code and GHC no -longer needs to remain compatible with GHC 7.2.x, then please update this -code to use promoted types. - - ************************************************************************ * * Branch lists @@ -125,11 +118,14 @@ code to use promoted types. type BranchIndex = Int -- The index of the branch in the list of branches -- Counting from zero --- the phantom type labels -data Unbranched deriving Typeable -data Branched deriving Typeable +-- promoted data type +data BranchFlag = Branched | Unbranched +type Branched = 'Branched +deriving instance Typeable 'Branched +type Unbranched = 'Unbranched +deriving instance Typeable 'Unbranched -data BranchList a br where +data BranchList a (br :: BranchFlag) where FirstBranch :: a -> BranchList a br NextBranch :: a -> BranchList a br -> BranchList a Branched |