I wrote a program with haskell
, but I got errors from ghci
Here are the sources, I’ll build it, and if I have
p1 :: Prop p1 = And (Var 'A') (Not (Var 'A'))
It will show A && ~A
, so these are the source codes
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 ++ ")"
And I have two main errors from ghci ...
Not in scope: data constructor `Char' Not in scope: data constructor `Prop'
I start with haskell, thank you very much.
source share