From 0ea1d4f75b96da593c98b534a566a370c6ea18a3 Mon Sep 17 00:00:00 2001 From: CSchank Date: Sat, 6 Jul 2019 14:16:30 -0400 Subject: [PATCH] fix shadowing error in encode generation --- package.yaml | 2 +- src/Generate/Codec.hs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.yaml b/package.yaml index dea252d..c98ed2c 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: petri-app-land -version: 0.1.12.1 +version: 0.1.12.2 github: "cschank/petri-app-land" license: BSD3 author: "Christopher William Schankula" diff --git a/src/Generate/Codec.hs b/src/Generate/Codec.hs index 1e1c1cf..ff933af 100644 --- a/src/Generate/Codec.hs +++ b/src/Generate/Codec.hs @@ -66,15 +66,18 @@ generateEncoder l (CustomT name edts) = ,T.concat [" tConcat[fst",indtTxt,"Txt,\"",delim,"\",snd",indtTxt,"Txt,\"",delim,"\",thd",indtTxt,"Txt]"] ] encodeEt indt (ListT (et, etn, etd), n, _) = + let + indtTxt = T.pack $ show indt + in indtTxts indt [T.concat[n, "Txt ="] ," let" ,T.concat[" encode",n,"_ _ (str",T.pack $ show indt,",",n,"List) ="] ,T.concat[" case ",n,"List of"] - ,T.concat[" ",etn," " .:. " rest ->"] + ,T.concat[" ",etn," " .:. " rest",indtTxt," ->"] ," let"] ++ (encodeEt (indt+6) (et, etn, etd)) ++ indtTxts indt [" in" - ,T.concat[" (tConcat [str",T.pack $ show indt,",\"",delim,"\",",etn,"Txt], rest)"] + ,T.concat[" (tConcat [str",T.pack $ show indt,",\"",delim,"\",",etn,"Txt], rest",indtTxt,")"] ,T.concat[" [] -> (str",T.pack $ show indt,",",n,"List)"] ,T.concat[" encode",n," ls ="] ,T.concat[" lFoldl encode",n,"_ (\"\",ls) (lRange 0 (lLength ",n,"))"]