Sehen Sie sich meinen Code an. GHCI gesagt, dassHaskell, keine Instanz für (Applicative M)
Kein Beispiel für (Applicative M) von den übergeordneten Klassen einer Instanz Erklärung entsteht In der Instanzdeklaration für ‚Monad M‘
ich nicht diesen Fehler verstehen, und ich weiß nicht weiß, wie man es repariert. Kannst du mir helfen ?
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))
Grundsätzlich http://stackoverflow.com/questions/31652475/defining-a-new-monad-in-haskell-raises-no-instance-for-applicative/31652592#31652592, die Regeln in GHC geändert 7,10 – MathematicalOrchid