Skip to content

Commit

Permalink
Better generation of dirty id of expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
hanjoosten committed May 9, 2023
1 parent 49618ca commit 1614cf1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Ampersand/Core/AbstractSyntaxTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,17 @@ instance Hashable Expression where
EMp1 val c -> (21 :: Int) `hashWithSalt` show val `hashWithSalt` c

instance Unique Expression where
showUnique = toText1Unsafe . tshow -- showA is not good enough: epsilons are disguised, so there can be several different
-- expressions with the same showA.
showUnique e = toText1Unsafe txt
where
txt =
"Expression_"
<> ( tshow
. hash
. tshow -- showA is not good enough: epsilons are disguised, so there can be several different
)
e

-- expressions with the same showA.

instance Unique (PairView Expression) where
showUnique = toText1Unsafe . tshow
Expand Down

0 comments on commit 1614cf1

Please sign in to comment.