I'm trying to write a parser in Haskell, but I'm having issues with the Alternative definition of it ( Functor, Applicative and Monad are done and working ):
instance Alternative Parser where
empty = P (\env input -> [])
p <|> q = P (\env input -> case parse p env input of
[] -> parse q env input
[(env, v, out)]-> [(env, v, out)])
As soon as I compile with Stack (stack build; stack run;), I get these errors, for both empty and <|> operators:
`empty' is not a (visible) method of class `Alternative'
`<|>' is not a (visible) method of class `Alternative'
Any ideas?