Hi,,
I am new to use ..plz bare with me..
How do we write two conditions using guards
suppose if we have a if condition if t1 t2 t3
typing :: TypingContext -> Term -> Maybe Type
--the typing relation
typing capGamma (Var x) = contextLookup x capGamma
typing capGama Tru = Just(TypeBool)
typing capGama Fls = Just(TypeBool)
typing capGama Zero = Just(TypeBool)
typing capGama (Succ t) = typing capGama t
typing capGama (Pred t) = typing capGama t
typing capGama (IsZero t) = typing capGama t
typing capGama (If t1 t2 t3)
| typing capGama t1 == TypeBool && typing capGama t2 == x = Just(x)
| otherwise = Nothing
where x = typing capGama t3
its giving me error
Couldn't match expected type `Maybe Type'
against inferred type `Type'
In the second argument of `(==)', namely `TypeBool'
In the first argument of `(&&)', namely
`typing capGama t1 == TypeBool'
In the expression:
typing capGama t1 == TypeBool && typing capGama t2 == TypeBool
how can i give two conditions in a single guard...