Hi guys,
I'm doing Write yourself Scheme tutorial. And for testing it would be cool to have some kind of macro.
-- My data type with Eq derived
data LispError = NumArgs Integer [LispVal]
| TypeMismatch String LispVal
| Parser ParseError
| BadSpecialForm String LispVal
| NotFunction String String
| UnboundVar String String
| Default String
deriving (Eq)
-- I can call ==
NumArgs 1 [] == NumArgs 1 []
-- but sometimes I want to do (I know I can implement my own Eq, but I want to use both forms)
NumArgs 1 [] == NumArgs 1 _
where I omit second parameter. I think derived Eq where it matches all the args is fine I just need to do macro which will get whateverType by compiler and always return True in Equality check. Do you think it is possible to do? I use Mockito library in java but java is OO, so completely different beast.
Thank you