でプログラムを書きましたhaskell
が、ghci からエラーが発生しました
これがソースコードです。私はそれを構築します。
p1 :: Prop
p1 = And (Var 'A') (Not (Var 'A'))
表示されるA && ~A
ので、それがソースコードです
import Data.List
import Data.Char
data Prop = Const Bool |
Var Char |
Not Prop |
And Prop Prop |
Or Prop Prop |
Imply Prop Prop
deriving Eq
instance Show Prop where
show (Var Char) = show Char
show (Not Prop) = "(~" ++ show Prop ++ ")"
show (And Prop Prop) = "(" ++ show Prop ++ "&&" ++ show Prop ++ ")"
show (Or Prop Prop) = "(" ++ show Prop "||" ++ show Prop ++ ")"
show (Imply Prop Prop) = "(" ++ show Prop "=>" show Prop ++ ")"
そして、ghciから2つの主なエラーが発生しました...
Not in scope: data constructor `Char'
Not in scope: data constructor `Prop'
Haskell初心者です、よろしくお願いします。