fixed minor bug in dedupNames
This commit is contained in:
parent
e6f9d71c57
commit
1ed998c025
1 changed files with 10 additions and 7 deletions
17
lib/Expr.hs
17
lib/Expr.hs
|
|
@ -65,13 +65,16 @@ dedupNames :: Expr -> Expr
|
|||
dedupNames = go []
|
||||
where
|
||||
varName :: [Text] -> Text -> Int -> Text
|
||||
varName bs x k = case bs !!? k of
|
||||
Nothing -> x
|
||||
Just x' ->
|
||||
let count = (length $ filter (== x') $ drop (k + 1) bs)
|
||||
in if count > 0
|
||||
then x <> printLevel count
|
||||
else x
|
||||
varName bs x k =
|
||||
if x == ""
|
||||
then x
|
||||
else case bs !!? k of
|
||||
Nothing -> x
|
||||
Just x' ->
|
||||
let count = (length $ filter (== x') $ drop (k + 1) bs)
|
||||
in if count > 0
|
||||
then x <> printLevel count
|
||||
else x
|
||||
|
||||
go :: [Text] -> Expr -> Expr
|
||||
go bs (Var x k) = Var (varName bs x (fromIntegral k)) k
|
||||
|
|
|
|||
Loading…
Reference in a new issue