diff options
author | Joe Crayne <joe@jerkface.net> | 2019-03-27 16:00:47 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-03-27 16:00:47 -0400 |
commit | 5d98b03204e98259d8219c615199c796c286bb55 (patch) | |
tree | 750ec4e0d1f2a8b741aaed781dfef785ada77cc7 /Unique.hs | |
parent | cae75f8c303edc717ca222adb9058b65a0f6ded6 (diff) |
Switch to using Unique symbols to simplify namespace hygiene.
Diffstat (limited to 'Unique.hs')
-rw-r--r-- | Unique.hs | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1,8 +1,10 @@ | |||
1 | module Unique | 1 | module Unique |
2 | ( UniqueFactory | 2 | ( UniqueFactory |
3 | , freshUniques | 3 | , freshUniques |
4 | , genUnique | ||
4 | , Unique | 5 | , Unique |
5 | , uniqueSymbol | 6 | , uniqueSymbol |
7 | , uniquePattern | ||
6 | , substituteUnique | 8 | , substituteUnique |
7 | , multipleOccurances | 9 | , multipleOccurances |
8 | ) where | 10 | ) where |
@@ -25,6 +27,9 @@ genUnique (UniqueFactory c) = (Unique c, UniqueFactory (succ c)) | |||
25 | uniqueSymbol :: Unique -> Exp () | 27 | uniqueSymbol :: Unique -> Exp () |
26 | uniqueSymbol (Unique i) = Var () (UnQual () (Ident () (showSym i))) | 28 | uniqueSymbol (Unique i) = Var () (UnQual () (Ident () (showSym i))) |
27 | 29 | ||
30 | uniquePattern :: Unique -> Pat () | ||
31 | uniquePattern (Unique i) = PVar () (Ident () (showSym i)) | ||
32 | |||
28 | showSym :: Integer -> String | 33 | showSym :: Integer -> String |
29 | showSym i = " u" ++ show i | 34 | showSym i = " u" ++ show i |
30 | 35 | ||