Skip to content

Commit

Permalink
Inferred types made more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
barbuz committed Feb 17, 2021
1 parent 71b5c50 commit 5e3866e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Expr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ instance (Show lit) => Show (Exp lit) where
show (EVar name) = name
show (ELine n) = "line" ++ show n
show (ELit lit) = show lit
show (EApp a b) = show a ++ "(" ++ show b ++ ")"
show (EApp a b) | show a == "app" = show b
| show a `elem` words "com4 com3 com2 com" = "(" ++ show b ++ ")`" ++ show a ++ "`"
| otherwise = show a ++ "(" ++ show b ++ ")"
show (EOp a b c) = show $ EApp (EApp a b) c
show (EAbs name exp) = "(\\" ++ name ++ "." ++ show exp ++ ")"
show (ELet name exp body) = "let " ++ name ++ "=(" ++ show exp ++ ") in " ++ show body
Expand Down

0 comments on commit 5e3866e

Please sign in to comment.