Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctorWithIndex for Kleisli #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.13.20211030
# version: 0.14.2
#
# REGENDATA ("0.13.20211030",["--config=cabal.haskell-ci","github","cabal.project"])
# REGENDATA ("0.14.2",["--config=cabal.haskell-ci","github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -24,6 +24,8 @@ jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
runs-on: ubuntu-18.04
timeout-minutes:
60
container:
image: buildpack-deps:bionic
continue-on-error: ${{ matrix.allow-failure }}
Expand Down Expand Up @@ -179,6 +181,10 @@ jobs:
repository hackage.haskell.org
url: http://hackage.haskell.org/
EOF
cat >> $CABAL_CONFIG <<EOF
program-default-options
ghc-options: $GHCJOBS +RTS -M3G -RTS
EOF
cat $CABAL_CONFIG
- name: versions
run: |
Expand Down
2 changes: 1 addition & 1 deletion haskell-ci.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# shellcheck disable=SC2086,SC2016,SC2046
# REGENDATA ("0.13.20211030",["bash","cabal.project"])
# REGENDATA ("0.14.2",["bash","cabal.project"])

set -o pipefail

Expand Down
7 changes: 6 additions & 1 deletion indexed-traversable/src/WithIndex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Prelude
import Control.Applicative
(Applicative (..), Const (..), ZipList (..), (<$>), liftA2)
import Control.Applicative.Backwards (Backwards (..))
import Control.Arrow (Kleisli (..))
import Control.Monad.Trans.Identity (IdentityT (..))
import Control.Monad.Trans.Reader (ReaderT (..))
import Data.Array (Array)
Expand Down Expand Up @@ -280,6 +281,10 @@ instance TraversableWithIndex Int ZipList where
itraverse f (ZipList xs) = ZipList <$> itraverse f xs
{-# INLINE itraverse #-}

instance Functor m => FunctorWithIndex a (Kleisli m a) where
imap f (Kleisli p) = Kleisli (\x -> f x <$> p x)
{-# INLINE imap #-}

-------------------------------------------------------------------------------
-- (former) semigroups
-------------------------------------------------------------------------------
Expand All @@ -296,7 +301,7 @@ instance TraversableWithIndex Int NonEmpty where
{-# INLINE itraverse #-}

-------------------------------------------------------------------------------
-- Functors (formely) from transformers
-- Functors (formerly) from transformers
-------------------------------------------------------------------------------

instance FunctorWithIndex () Identity where
Expand Down