In my homework I have to define the logic operators as follows:
Using this data structure:
data MyBool = Cierto|Falso deriving (Show,Eq) -- Cierto = True and Falso = False
data PQR = A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z deriving (Show,Eq)
data Formula = VarProp PQR
|Neg Formula -- logic not
|Formula :|: Formula -- logic or
|Formula :&: Formula -- logic and... etc
|Formula :->: Formula
|Formula :<->: Formula deriving (Show,Eq)
And I have to define functions that tell me if a given formula is True or False, so for example if I write (Cierto :&: Falso) the answer has to be: Falso.
According to my teacher the function has to be called in this case :&: and has to receive MyBool types so I tried to implemented like this:
infixr 3 :&:
(:&:) :: MyBool -> MyBool -> MyBool
Cierto :&: x = x
Falso :&: x = Falso
but when I try to load it it says:
Invalid type signature
I don't know what I doing wrong here.
<code>tag doesn't work on this site; you should preface each line in a code block with four spaces.