Look at my code. ghci told that
No instance for (Applicative M) arising from the superclasses of an instance declaration In the instance declaration for ‘Monad M’
I don't understand this error, and I don't know how to fix it. Could you help me ?
newtype M a = StOut (Stack -> (a, Stack, String))
unStOut (StOut f) = f
--unStout is used to extract the emeded function from monadic capsule
instance Monad M where
return x = StOut (\n -> (x, n, ""))
e >>= f = StOut (\n -> let (a, n1, s1) = (unStOut e) n
(b, n2, s2) = (unStOut (f a)) n1
in (b, n2, s1++s2))