编程 haskell

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/11 21:52:06
编程 haskell
xj@_e#IxWR):= y7%{{ u]I`Mljw槿lnN?n{%Ӝr5 6k O]]K![“Mc1CԍC 2=ߤ\g !8%[5rA8$~\NƲ" Fb?Ahy%B?i@"6ŭ Q*A9J}J(xhC-.lNrh}A6푫TԚ7 j4Po{NML EnT5A﮷ E*P1>J=}KQmA?p&::B!h+_m<@_QE `L]moؔNZo3:ܡoby_{ +

编程 haskell
编程 haskell

编程 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


试试看吧