That would be incompatible with the ap of the monad where it exists,
but it's worse than that.  Which state will you return?  If you return
one of the states output by one or other of the arguments, you'll break
one of the laws:

        pure id <*> v = v
        u <*> pure y = pure ($ y) <*> u

You're forced to return the input state, so the Applicative would just
be an obfuscated Reader.

Which reminds me ofc, that there is a valid applicative for states (assuming the monad instance is valid):

instance Applicative (StateT s f) where
  pure = return
  (<*>) = ap

All monads are also applicatives ;)

Bob
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to