on master help sign in
Improve printing of foreign calls.
b5c7a14Matus Tejiscak
src/IRTS/Lang.hs+9−2
@@ -231,8 +231,15 @@ instance Show LExp where
231 show' env (LCase e alts) = "case " ++ show' env e ++ " of {\n\t" ++
231 show' env (LCase e alts) = "case " ++ show' env e ++ " of {\n\t" ++
232 showSep "\n\t| " (map (showAlt env) alts)
232 showSep "\n\t| " (map (showAlt env) alts)
233 show' env (LConst c) = show c
233 show' env (LConst c) = show c
234− show' env (LForeign lang ty n args)
234+ show' env (LForeign lang ty n args) = concat
235+ [ "foreign { "
236+ , n ++ "("
235− = "foreign " ++ n ++ "(" ++ showSep ", " (map (show' env) (map snd args)) ++ ")"
237+ , showSep ", " (map (\(ty,x) -> show' env x ++ " : " ++ show ty) args)
238+ , ") : "
239+ , show ty
240+ , " }"
241+ ]
242+
236 show' env (LOp f args) = show f ++ "(" ++ showSep ", " (map (show' env) args) ++ ")"
243 show' env (LOp f args) = show f ++ "(" ++ showSep ", " (map (show' env) args) ++ ")"
237 show' env (LError str) = "error " ++ show str
244 show' env (LError str) = "error " ++ show str
238 show' env LNothing = "____"
245 show' env LNothing = "____"