|
| 1 | +{-# LANGUAGE DeriveAnyClass #-} |
1 | 2 | {-# LANGUAGE DeriveGeneric #-} |
2 | 3 | {-# LANGUAGE DerivingStrategies #-} |
3 | 4 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
@@ -43,6 +44,12 @@ data QualifiedConstructor = QualifiedConstructor |
43 | 44 | data Lifted = Lifted !Qualified !Int |
44 | 45 | deriving (Eq, Ord, Show, Generic) |
45 | 46 |
|
| 47 | +data Lowered = Lowered !Lifted !LoweredKind |
| 48 | + deriving (Eq, Ord, Show, Generic) |
| 49 | + |
| 50 | +data LoweredKind = Original | Init | Inited |
| 51 | + deriving (Eq, Ord, Show, Generic, Hashable) |
| 52 | + |
46 | 53 | unqualifyConstructor :: QualifiedConstructor -> Constructor |
47 | 54 | unqualifyConstructor (QualifiedConstructor _ c) = c |
48 | 55 |
|
@@ -114,3 +121,17 @@ instance Hashable Lifted where |
114 | 121 |
|
115 | 122 | hash (Lifted m n) = |
116 | 123 | hash m `hashWithSalt` n |
| 124 | + |
| 125 | +instance Pretty Lowered where |
| 126 | + pretty (Lowered name loweredKind) = |
| 127 | + case loweredKind of |
| 128 | + Original -> pretty name |
| 129 | + Init -> pretty name <> "$init" |
| 130 | + Inited -> pretty name <> "$inited" |
| 131 | + |
| 132 | +instance Hashable Lowered where |
| 133 | + hashWithSalt = |
| 134 | + defaultHashWithSalt |
| 135 | + |
| 136 | + hash (Lowered m n) = |
| 137 | + hash m `hashWithSalt` n |
0 commit comments