applicative

Haskell Applicative and ErrorT?

Why is it that I can do the following: import Data.Word import Data.Binary.Get import Control.Applicative import Control.Monad.Error getW1 :: ErrorT String Get Word8 getW1 = lift getWord8 f1 = (+1) <$> getW1 but I cannot do: f2 = (+) <$> getW1 <*> getW1 and how I do I modify f2 so that it will work as I intend? ...

Is there an equivalent in Scala to Python's more general map function?

I know that Scala's Lists have a map implementation with signature (f: (A) => B):List[B] and a foreach implementation with signature (f: (A) => Unit):Unit but I'm looking for something that accepts multiple iterables the same way that the Python map accepts multiple iterables. I'm looking for something with a signature of (f: (A,B) => C...

Naming of `pure` function in Control.Applicative

Why is the function for lifting a value into a functor named pure in Control.Applicative? ...

Functor / Applicative instances for State in Haskell

After reading (and skimming some sections of) Wadler's paper on monads, I decided to work through the paper more closely, defining functor and applicative instances for each of the monads he describes. Using the type synonym type M a = State -> (a, State) type State = Int Wadler uses to define the state monad, I have the following (us...