on master help sign in
Even prettier printing of LExps.
ba81129Matus Tejiscak
src/IRTS/Lang.hs+8−2
@@ -239,8 +239,14 @@ instance Show LExp where
239 = show n ++ "(" ++ showSep ", " (map (show' env ind) args) ++ ")"
239 = show n ++ "(" ++ showSep ", " (map (show' env ind) args) ++ ")"
240
240
241 show' env ind (LCase e alts)
241 show' env ind (LCase e alts)
242− = "case " ++ show' env ind e ++ " of \n" ++
242+ = "case " ++ show' env ind e ++ " of \n" ++ fmt alts
243− intercalate "\n" ["\t" ++ ind ++ " | " ++ showAlt env (" " ++ ind) alt | alt <- alts]
243+ where
244+ fmt [] = ""
245+ fmt [alt]
246+ = "\t" ++ ind ++ " | " ++ showAlt env (ind ++ " ") alt
247+ fmt (alt:as)
248+ = "\t" ++ ind ++ " | " ++ showAlt env (ind ++ " ` ") alt
249+ ++ "\n" ++ fmt as
244
250
245 show' env ind (LConst c) = show c
251 show' env ind (LConst c) = show c
246
252