Skip to content

Commit

Permalink
fix shadowing error in encode generation
Browse files Browse the repository at this point in the history
  • Loading branch information
CSchank committed Jul 6, 2019
1 parent cfe2454 commit 0ea1d4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 5 additions & 2 deletions src/Generate/Codec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,"))"]
Expand Down

0 comments on commit 0ea1d4f

Please sign in to comment.