-
-
Save Lysxia/d46f4dddcfdb2267e56d42b05dfc2fca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- src/A.hs | |
{-# LANGUAGE ScopedTypeVariables, TypeApplications #-} | |
module A where | |
import Control.Monad.Trans.State | |
import Data.Coerce | |
mapAccumLM :: forall a b c m t. | |
(Traversable t, Monad m) => (b -> a -> m (c, a)) -> t b -> a -> m (t c, a) | |
mapAccumLM f = coerce (traverse @t @(StateT a m) @b @c) f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- src/B.hs | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# OPTIONS_GHC -ddump-simpl -dsuppress-all -ddump-to-file #-} | |
module B where | |
import Control.Monad.Trans.Reader | |
import A | |
mapAccumLList :: forall a b c x. | |
(b -> a -> ReaderT x Maybe (c, a)) -> [b] -> a -> ReaderT x Maybe ([c], a) | |
mapAccumLList = mapAccumLM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cabal-version: 3.0 | |
name: t | |
version: 0.1.0.0 | |
build-type: Simple | |
common warnings | |
ghc-options: -Wall | |
library | |
import: warnings | |
exposed-modules: A, B | |
build-depends: base, transformers | |
hs-source-dirs: src | |
default-language: Haskell2010 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment