This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
data Formula = Atom String | Unary String Formula | Binary String Formula Formula | |
instance Show Formula where | |
show (Atom name) = name | |
show (Unary op remaining) = op ++ " " ++ (show remaining) | |
show (Binary op left right) = "(" ++ (show left) ++ " " ++ op ++ " " ++ (show right) ++ ")" | |
unaries = ["-"] |