on master help sign in
Even prettier printing of LExps.
commitba811298986dd3384c2af9442ccdc47ed2e34b66 authorMatus Tejiscak <ziman@functor.sk> dateThu 27 Mar 2014, 15:52 (13 years ago) parent5a8e4f4
1 file changed+8−2
src/IRTS/Lang.hs+8−2
src/IRTS/Lang.hs+8−2
@@ -239,8 +239,14 @@ instance Show LExp where
239239 = show n ++ "(" ++ showSep ", " (map (show' env ind) args) ++ ")"
240240
241241 show' env ind (LCase e alts)
242− = "case " ++ show' env ind e ++ " of \n" ++
243− intercalate "\n" ["\t" ++ ind ++ " | " ++ showAlt env (" " ++ ind) alt | alt <- alts]
242+ = "case " ++ show' env ind e ++ " of \n" ++ fmt 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
244250
245251 show' env ind (LConst c) = show c
246252