Skip to content

Instantly share code, notes, and snippets.

@techtangents
Created November 23, 2014 03:19
Show Gist options
  • Save techtangents/0a45a34782379efff983 to your computer and use it in GitHub Desktop.
Save techtangents/0a45a34782379efff983 to your computer and use it in GitHub Desktop.
module Mappy where
import Control.Monad.State.Trans
import Data.Traversable
import Data.Tuple
import Control.Monad.State
import Control.Monad.State.Class
mapAccumL :: forall a b c t. (Traversable t) => (a -> b -> Tuple c a) -> a -> t b -> Tuple (t c) a
mapAccumL f s t =
runState (traverse (state <<< (flip f)) t) s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment