@@ -213,43 +213,55 @@ usedIn env (LOp f args) = concatMap (usedIn env) args
213usedIn env _ = []
213usedIn env _ = []
215instance Show LExp where
215instance Show LExp where
216− show e = show' [] e where
216+ show e = show' [] "" e where
217− show' env (LV (Loc i)) = env!!i
217+ show' env ind (LV (Loc i)) = env!!i
218− show' env (LV (Glob n)) = show n
218+ show' env ind (LV (Glob n)) = show n
219− show' env (LLazyApp e args) = show e ++ "|(" ++
220+ show' env ind (LLazyApp e args)
220− showSep ", " (map (show' env) args) ++")"
221+ = show e ++ "|(" ++ showSep ", " (map (show' env ind) args) ++")"
221− show' env (LApp _ e args) = show' env e ++ "(" ++
223+ show' env ind (LApp _ e args)
222− showSep ", " (map (show' env) args) ++")"
224+ = show' env ind e ++ "(" ++ showSep ", " (map (show' env ind) args) ++")"
223− show' env (LLazyExp e) = "lazy{ " ++ show' env e ++ " }"
226+ show' env ind (LLazyExp e) = "lazy{ " ++ show' env ind e ++ " }"
224− show' env (LForce e) = "force{ " ++ show' env e ++ " }"
227+ show' env ind (LForce e) = "force{ " ++ show' env ind e ++ " }"
228+ show' env ind (LLet n v e)
225− show' env (LLet n v e) = "let " ++ show n ++ " = " ++ show' env v ++ " in " ++
229+ = "let " ++ show n ++ " = " ++ show' env ind v
226− show' (env ++ [show n]) e
230+ ++ " in " ++ show' (env ++ [show n]) ind e
232+ show' env ind (LLam args e)
227− show' env (LLam args e) = "\\ " ++ showSep "," (map show args) ++ " => " ++
233+ = "\\ " ++ showSep "," (map show args)
228− show' (env ++ (map show args)) e
234+ ++ " => " ++ show' (env ++ (map show args)) ind e
229− show' env (LProj t i) = show t ++ "!" ++ show i
236+ show' env ind (LProj t i) = show t ++ "!" ++ show i
238+ show' env ind (LCon i n args)
230− show' env (LCon i n args) = show n ++ ")" ++ showSep ", " (map (show' env) args) ++ ")"
239+ = show n ++ "(" ++ showSep ", " (map (show' env ind) args) ++ ")"
231− show' env (LCase e alts) = "case " ++ show' env e ++ " of \n" ++
241+ show' env ind (LCase e alts)
242+ = "case " ++ show' env ind e ++ " of \n" ++
232− unlines (map (("\t | " ++) . showAlt env) alts)
243+ intercalate "\n" ["\t" ++ ind ++ " | " ++ showAlt env (" " ++ ind) alt | alt <- alts]
233− show' env (LConst c) = show c
245+ show' env ind (LConst c) = show c
234− show' env (LForeign lang ty n args) = concat
247+ show' env ind (LForeign lang ty n args) = concat
235 [ "foreign{ "
248 [ "foreign{ "
236 , n ++ "("
249 , n ++ "("
237− , showSep ", " (map (\(ty,x) -> show' env x ++ " : " ++ show ty) args)
250+ , showSep ", " (map (\(ty,x) -> show' env ind x ++ " : " ++ show ty) args)
239 , show ty
252 , show ty
256+ show' env ind (LOp f args)
243− show' env (LOp f args) = show f ++ "(" ++ showSep ", " (map (show' env) args) ++ ")"
257+ = show f ++ "(" ++ showSep ", " (map (show' env ind) args) ++ ")"
244− show' env (LError str) = "error " ++ show str
245− show' env LNothing = "____"
247− showAlt env (LConCase _ n args e)
248− = show n ++ "(" ++ showSep ", " (map show args) ++ ") => "
250− showAlt env (LConstCase c e) = show c ++ " => " ++ show' env e
251− showAlt env (LDefaultCase e) = "_ => " ++ show' env e
259+ show' env ind (LError str) = "error " ++ show str
260+ show' env ind LNothing = "____"
262+ showAlt env ind (LConCase _ n args e)
263+ = show n ++ "(" ++ showSep ", " (map show args) ++ ") => "
266+ showAlt env ind (LConstCase c e) = show c ++ " => " ++ show' env ind e
267+ showAlt env ind (LDefaultCase e) = "_ => " ++ show' env ind e