Skip to content

Commit 76ad198

Browse files
committed
Add Lowered Name
1 parent 2d1e10b commit 76ad198

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/Name.hs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{-# LANGUAGE DeriveAnyClass #-}
12
{-# LANGUAGE DeriveGeneric #-}
23
{-# LANGUAGE DerivingStrategies #-}
34
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
@@ -43,6 +44,12 @@ data QualifiedConstructor = QualifiedConstructor
4344
data Lifted = Lifted !Qualified !Int
4445
deriving (Eq, Ord, Show, Generic)
4546

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+
4653
unqualifyConstructor :: QualifiedConstructor -> Constructor
4754
unqualifyConstructor (QualifiedConstructor _ c) = c
4855

@@ -114,3 +121,17 @@ instance Hashable Lifted where
114121

115122
hash (Lifted m n) =
116123
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

Comments
 (0)