Skip to content

Commit 25732e6

Browse files
authored
Fix uconv to allow an arbitrary number of variables (#7560)
1 parent a08c402 commit 25732e6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

plutus-metatheory/src/FFI/Untyped.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ conv (Force _ t) = UForce (conv t)
4343
conv (Constr _ i es) = UConstr (toInteger i) (toList (fmap conv es))
4444
conv (Case _ arg cs) = UCase (conv arg) (toList (fmap conv cs))
4545

46-
tmnames :: String
47-
tmnames = ['a' .. 'z']
46+
tmname :: Int -> String
47+
tmname i = 'x' : show i
4848

4949
uconv :: Int -> UTerm -> Term NamedDeBruijn DefaultUni DefaultFun ()
5050
uconv i (UVar x) =
5151
Var
5252
()
5353
( NamedDeBruijn
54-
(T.pack [tmnames !! (i - 1 - fromInteger x)])
54+
(T.pack (tmname (i - 1 - fromInteger x)))
5555
-- PLC's debruijn starts counting from 1, while in the metatheory it starts from 0.
5656
(Index (fromInteger x + 1))
5757
)
5858
uconv i (ULambda t) =
5959
LamAbs
6060
()
61-
(NamedDeBruijn (T.pack [tmnames !! i]) deBruijnInitIndex)
61+
(NamedDeBruijn (T.pack (tmname i)) deBruijnInitIndex)
6262
(uconv (i + 1) t)
6363
uconv i (UApp t u) = Apply () (uconv i t) (uconv i u)
6464
uconv _ (UCon c) = Constant () c

0 commit comments

Comments
 (0)