编程 haskell
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/04 14:26:34
编程 haskell
data Prop = Const Bool
| Var Char
| Not Prop
| And Prop Prop
| Or Prop Prop
| Imply Prop Prop
deriving Eq
instance Show Prop where
show (Const a) = "Const " ++ show a
show (Var a) = show a
show (And a b) = show a ++ " && " ++ show b
show (Or a b) = show a ++ " || " ++ show b
show (Not a) = "!(" ++ show a ++ ")"
show (Imply a b) = show a ++ " => " ++ show b
试试看吧
再问: 不能把'A' 的' '去掉么。。
| Var Char
| Not Prop
| And Prop Prop
| Or Prop Prop
| Imply Prop Prop
deriving Eq
instance Show Prop where
show (Const a) = "Const " ++ show a
show (Var a) = show a
show (And a b) = show a ++ " && " ++ show b
show (Or a b) = show a ++ " || " ++ show b
show (Not a) = "!(" ++ show a ++ ")"
show (Imply a b) = show a ++ " => " ++ show b
试试看吧
再问: 不能把'A' 的' '去掉么。。