comonad 5.0.4 → 5.0.10
raw patch · 27 files changed
Files
- .ghci +0/−1
- .gitignore +1/−1
- .hlint.yaml +4/−0
- .travis.yml +0/−164
- CHANGELOG.markdown +32/−0
- HLint.hs +0/−4
- README.markdown +1/−1
- Setup.lhs +1/−29
- Warning.hs +0/−5
- comonad.cabal +37/−50
- examples/History.hs +1/−1
- src/Control/Comonad.hs +8/−52
- src/Control/Comonad/Env.hs +0/−5
- src/Control/Comonad/Env/Class.hs +0/−7
- src/Control/Comonad/Hoist/Class.hs +1/−0
- src/Control/Comonad/Identity.hs +0/−5
- src/Control/Comonad/Store.hs +0/−5
- src/Control/Comonad/Store/Class.hs +0/−8
- src/Control/Comonad/Traced.hs +0/−5
- src/Control/Comonad/Traced/Class.hs +0/−8
- src/Control/Comonad/Trans/Class.hs +0/−5
- src/Control/Comonad/Trans/Env.hs +9/−47
- src/Control/Comonad/Trans/Identity.hs +0/−5
- src/Control/Comonad/Trans/Store.hs +3/−36
- src/Control/Comonad/Trans/Traced.hs +13/−42
- src/Data/Functor/Composition.hs +1/−0
- tests/doctests.hs +0/−25
− .ghci
@@ -1,1 +0,0 @@-:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h
.gitignore view
@@ -1,5 +1,5 @@ dist-dist-newstyle+dist-* docs wiki TAGS
+ .hlint.yaml view
@@ -0,0 +1,4 @@+- arguments: [--cpp-define=HLINT, --cpp-ansi]++- ignore: {name: Eta reduce}+- ignore: {name: Use import/export shortcut}
− .travis.yml
@@ -1,164 +0,0 @@-# This Travis job script has been generated by a script via-#-# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project'-#-# For more information, see https://github.com/hvr/multi-ghc-travis-#-language: c-sudo: false--git:- submodules: false # whether to recursively clone submodules--notifications:- irc:- channels:- - "irc.freenode.org#haskell-lens"- skip_join: true- template:- - "\x0313comonad\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"--cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store--before_cache:- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log- # remove files that are regenerated by 'cabal update'- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx-- - rm -rfv $HOME/.cabal/packages/head.hackage--matrix:- include:- - compiler: "ghc-8.6.1"- env: GHCHEAD=true- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}- - compiler: "ghc-8.2.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.0.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.10.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.8.4"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}- - compiler: "ghc-7.6.3"- env: HADDOCK=false # Work around https://github.com/haskell/haddock/issues/242- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.4.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.2.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.0.4"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}}- - compiler: "ghc-head"- env: GHCHEAD=true- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}-- allow_failures:- - compiler: "ghc-head"- - compiler: "ghc-7.0.4"- - compiler: "ghc-7.2.2"- - compiler: "ghc-8.6.1"--before_install:- - HC=${CC}- - HCPKG=${HC/ghc/ghc-pkg}- - unset CC- - ROOTDIR=$(pwd)- - mkdir -p $HOME/.local/bin- - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"- - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))- - echo $HCNUMVER--install:- - cabal --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - BENCH=${BENCH---enable-benchmarks}- - TEST=${TEST---enable-tests}- - HADDOCK=${HADDOCK-true}- - UNCONSTRAINED=${UNCONSTRAINED-true}- - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}- - GHCHEAD=${GHCHEAD-false}- - travis_retry cabal update -v- - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"- - rm -fv cabal.project cabal.project.local- # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage- - |- if $GHCHEAD; then- sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config- for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done-- echo 'repository head.hackage' >> ${HOME}/.cabal/config- echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config- echo ' secure: True' >> ${HOME}/.cabal/config- echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config- echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config- echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config- echo ' key-threshold: 3' >> ${HOME}/.cabal.config-- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'-- cabal new-update head.hackage -v- fi- - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'- - "printf 'packages: \".\" \"./examples\"\\n' > cabal.project"- - touch cabal.project.local- - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"- - cat cabal.project || true- - cat cabal.project.local || true- - if [ -f "./configure.ac" ]; then- (cd "." && autoreconf -i);- fi- - if [ -f "./examples/configure.ac" ]; then- (cd "./examples" && autoreconf -i);- fi- - rm -f cabal.project.freeze- - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all- - rm -rf .ghc.environment.* "."/dist "./examples"/dist- - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)--# Here starts the actual work to be performed for the package under test;-# any command which exits with a non-zero exit code causes the build to fail.-script:- # test that source-distributions can be generated- - (cd "." && cabal sdist)- - (cd "./examples" && cabal sdist)- - mv "."/dist/comonad-*.tar.gz "./examples"/dist/comonad-examples-*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;- - "printf 'packages: comonad-*/*.cabal comonad-examples-*/*.cabal\\n' > cabal.project"- - touch cabal.project.local- - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"- - cat cabal.project || true- - cat cabal.project.local || true-- # build & run tests, build benchmarks- - cabal new-build -w ${HC} ${TEST} ${BENCH} all- - if [ "x$TEST" = "x--enable-tests" ]; then cabal new-test -w ${HC} ${TEST} ${BENCH} all; fi-- # cabal check- - (cd comonad-* && cabal check)- - (cd comonad-examples-* && cabal check)-- # haddock- - rm -rf ./dist-newstyle- - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi--# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"]-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,35 @@+5.0.10 [2026.01.10]+-------------------+* Support building with MicroHs.+* Remove unused `transformers-compat` dependency.++5.0.9 [2024.12.04]+------------------+* Drop support for pre-8.0 versions of GHC.++5.0.8 [2020.12.30]+-----------------+* Explicitly mark modules as Safe or Trustworthy+* The build-type has been changed from `Custom` to `Simple`.+ To achieve this, the `doctests` test suite has been removed in favor of using [`cabal-docspec`](https://github.com/phadej/cabal-extras/tree/master/cabal-docspec) to run the doctests.++5.0.7 [2020.12.15]+------------------+* Move `FunctorWithIndex (TracedT m w)` instance from `lens`.+ This instance depends on the `indexed-traversable` package. This can be disabled using the flag of the same name.++5.0.6 [2019.11.26]+------------------+* Achieve forward compatibility with+ [GHC proposal 229](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst).++5.0.5 [2019.05.02]+------------------+* Raised the minimum `semigroups` version to 0.16.2. In addition, the+ package will only be required at all for GHCs before 8.0.+* Drop the `contravariant` flag from `comonad.cabal`, as `comonad` no longer+ depends on the `contravariant` library.+ 5.0.4 [2018.07.01] ------------------ * Add `Comonad` instances for `Tagged s` with `s` of any kind. Before the
− HLint.hs
@@ -1,4 +0,0 @@-import "hint" HLint.HLint--ignore "Eta reduce"-ignore "Use import/export shortcut"
README.markdown view
@@ -1,7 +1,7 @@ comonad ======= -[](https://hackage.haskell.org/package/comonad) [](http://travis-ci.org/ekmett/comonad)+[](https://github.com/ekmett/comonad/actions?query=workflow%3AHaskell-CI) This package provides comonads, the categorical dual of monads. The typeclass provides three methods: `extract`, `duplicate`, and `extend`.
Setup.lhs view
@@ -1,34 +1,6 @@ \begin{code}-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-} module Main (main) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "doctests"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-import Warning ()-#endif--import Distribution.Simple-+import Distribution.Simple (defaultMain) main :: IO () main = defaultMain--#endif- \end{code}
− Warning.hs
@@ -1,5 +0,0 @@-module Warning- {-# WARNING ["You are configuring this package without cabal-doctest installed.",- "The doctests test-suite will not work as a result.",- "To fix this, install cabal-doctest before configuring."] #-}- () where
comonad.cabal view
@@ -1,6 +1,6 @@ name: comonad category: Control, Comonads-version: 5.0.4+version: 5.0.10 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -13,31 +13,30 @@ Copyright (C) 2004-2008 Dave Menendez synopsis: Comonads description: Comonads.-build-type: Custom-tested-with: GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.3, GHC == 8.6.1+build-type: Simple+tested-with: GHC == 8.0.2+ , GHC == 8.2.2+ , GHC == 8.4.4+ , GHC == 8.6.5+ , GHC == 8.8.4+ , GHC == 8.10.7+ , GHC == 9.0.2+ , GHC == 9.2.8+ , GHC == 9.4.8+ , GHC == 9.6.7+ , GHC == 9.8.4+ , GHC == 9.10.3+ , GHC == 9.12.2+ , GHC == 9.14.1 extra-source-files:- .ghci .gitignore- .travis.yml+ .hlint.yaml .vim.custom coq/Store.v README.markdown CHANGELOG.markdown examples/History.hs- HLint.hs- Warning.hs -custom-setup- setup-depends:- base >= 4 && < 5,- Cabal,- cabal-doctest >= 1 && < 1.1---- You can disable the doctests test suite with -f-test-doctests-flag test-doctests- default: True- manual: True- flag containers description: You can disable the use of the `containers` package using `-f-containers`.@@ -46,24 +45,24 @@ default: True manual: True -flag contravariant+flag distributive description:- You can disable the use of the `contravariant` package using `-f-contravariant`.+ You can disable the use of the `distributive` package using `-f-distributive`. . Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users. .- If disabled we will not supply instances of `Contravariant`+ If disabled we will not supply instances of `Distributive` . default: True manual: True -flag distributive+flag indexed-traversable description:- You can disable the use of the `distributive` package using `-f-distributive`.+ You can disable the use of the `indexed-traversable` package using `-f-indexed-traversable`. . Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users. .- If disabled we will not supply instances of `Distributive`+ If disabled we will not supply instances of `FunctorWithIndex` . default: True manual: True@@ -71,7 +70,7 @@ source-repository head type: git- location: git://github.com/ekmett/comonad.git+ location: https://github.com/ekmett/comonad.git library hs-source-dirs: src@@ -79,21 +78,24 @@ ghc-options: -Wall build-depends:- base >= 4 && < 5,- semigroups >= 0.8.3.1 && < 1,- tagged >= 0.7 && < 1,- transformers >= 0.2 && < 0.6,- transformers-compat >= 0.3 && < 1+ base >= 4.9 && < 5,+ tagged >= 0.8.6.1 && < 1,+ transformers >= 0.5 && < 0.7 if flag(containers)- build-depends: containers >= 0.3 && < 0.7-- if flag(contravariant)- build-depends: contravariant >= 0.2.0.1 && < 2+ build-depends: containers >= 0.3 && < 0.9 if flag(distributive)- build-depends: distributive >= 0.2.2 && < 1+ build-depends: distributive >= 0.5.2 && < 1 + if flag(indexed-traversable)+ build-depends: indexed-traversable >= 0.1.1 && < 0.2++ if impl(ghc >= 9.0)+ -- these flags may abort compilation with GHC-8.10+ -- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295+ ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode+ exposed-modules: Control.Comonad Control.Comonad.Env@@ -118,18 +120,3 @@ FunctionalDependencies FlexibleInstances UndecidableInstances--test-suite doctests- type: exitcode-stdio-1.0- default-language: Haskell2010- main-is: doctests.hs- ghc-options: -Wall -threaded- hs-source-dirs: tests-- if !flag(test-doctests)- buildable: False- else- build-depends:- base,- comonad,- doctest >= 0.11.1 && < 0.17
examples/History.hs view
@@ -52,7 +52,7 @@ ini dx = extract dx `fby` extend ini dx fibo :: Num b => History a -> b-fibo d = wfix $ d $> fby 0 . extend (\dfibo -> extract dfibo + fby 1 dfibo) +fibo d = wfix $ d $> fby 0 . extend (\dfibo -> extract dfibo + fby 1 dfibo) fibo' :: Num b => History a -> b fibo' d = fst $ wfix $ d $> fby (0, 1) . fmap (\(x, x') -> (x',x+x'))
src/Control/Comonad.hs view
@@ -1,12 +1,8 @@ {-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 707-{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving, Safe, DefaultSignatures #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy, DefaultSignatures #-}-#endif-#if __GLASGOW_HASKELL__ >= 706+{-# LANGUAGE DefaultSignatures #-}+{-# LANGUAGE Safe #-}+{-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE PolyKinds #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad@@ -49,11 +45,6 @@ import Control.Arrow import Control.Category import Control.Monad (ap)-#if MIN_VERSION_base(4,7,0)--- Control.Monad.Instances is empty-#else-import Control.Monad.Instances-#endif import Control.Monad.Trans.Identity import Data.Functor.Identity import qualified Data.Functor.Sum as FSum@@ -62,7 +53,6 @@ import Data.Tagged import Prelude hiding (id, (.)) import Control.Monad.Fix-import Data.Typeable #ifdef MIN_VERSION_containers import Data.Tree@@ -146,9 +136,7 @@ extend :: (w a -> b) -> w a -> w b extend f = fmap f . duplicate -#if __GLASGOW_HASKELL__ >= 708 {-# MINIMAL extract, (duplicate | extend) #-}-#endif instance Comonad ((,)e) where@@ -157,7 +145,6 @@ extract = snd {-# INLINE extract #-} -#if MIN_VERSION_semigroups(0,16,2) instance Comonad (Arg e) where duplicate w@(Arg a _) = Arg a w {-# INLINE duplicate #-}@@ -165,7 +152,6 @@ {-# INLINE extend #-} extract (Arg _ b) = b {-# INLINE extract #-}-#endif instance Monoid m => Comonad ((->)m) where duplicate f m = f . mappend m@@ -179,14 +165,13 @@ extract = runIdentity {-# INLINE extract #-} -#if __GLASGOW_HASKELL__ >= 706 -- $ -- The variable `s` can have any kind. -- For example, here it has kind `Bool`: -- >>> :set -XDataKinds+-- >>> import Data.Tagged -- >>> extract (Tagged 42 :: Tagged 'True Integer) -- 42-#endif instance Comonad (Tagged s) where duplicate = Tagged {-# INLINE duplicate #-}@@ -206,7 +191,8 @@ #endif instance Comonad NonEmpty where- extend f w@ ~(_ :| aas) = f w :| case aas of+ extend f w@(~(_ :| aas)) =+ f w :| case aas of [] -> [] (a:as) -> toList (extend f (a :| as)) extract ~(a :| _) = a@@ -256,10 +242,8 @@ class Comonad w => ComonadApply w where (<@>) :: w (a -> b) -> w a -> w b-#if __GLASGOW_HASKELL__ >= 702 default (<@>) :: Applicative w => w (a -> b) -> w a -> w b (<@>) = (<*>)-#endif (@>) :: w a -> w b -> w b a @> b = const id <$> a <@> b@@ -298,8 +282,8 @@ -- | A suitable default definition for 'fmap' for a 'Comonad'. -- Promotes a function to a comonad. ----- You can only safely use to define 'fmap' if your 'Comonad'--- defined 'extend', not just 'duplicate', since defining+-- You can only safely use 'liftW' to define 'fmap' if your 'Comonad'+-- defines 'extend', not just 'duplicate', since defining -- 'extend' in terms of duplicate uses 'fmap'! -- -- @@@ -362,25 +346,7 @@ -- | The 'Cokleisli' 'Arrow's of a given 'Comonad' newtype Cokleisli w a b = Cokleisli { runCokleisli :: w a -> b }-#if __GLASGOW_HASKELL__ >= 707- deriving Typeable-#else-#ifdef __GLASGOW_HASKELL__-instance Typeable1 w => Typeable2 (Cokleisli w) where- typeOf2 twab = mkTyConApp cokleisliTyCon [typeOf1 (wa twab)]- where wa :: Cokleisli w a b -> w a- wa = undefined-#endif -cokleisliTyCon :: TyCon-#if MIN_VERSION_base(4,4,0)-cokleisliTyCon = mkTyCon3 "comonad" "Control.Comonad" "Cokleisli"-#else-cokleisliTyCon = mkTyCon "Control.Comonad.Cokleisli"-#endif-{-# NOINLINE cokleisliTyCon #-}-#endif- instance Comonad w => Category (Cokleisli w) where id = Cokleisli extract Cokleisli f . Cokleisli g = Cokleisli (f =<= g)@@ -412,13 +378,3 @@ instance Monad (Cokleisli w a) where return = pure Cokleisli k >>= f = Cokleisli $ \w -> runCokleisli (f (k w)) w--#if !(MIN_VERSION_base(4,7,0))--infixl 4 $>---- | Replace the contents of a functor uniformly with a constant value.-($>) :: Functor f => f a -> b -> f b-($>) = flip (<$)--#endif
src/Control/Comonad/Env.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Env
src/Control/Comonad/Env/Class.hs view
@@ -2,12 +2,7 @@ {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Env.Class@@ -44,10 +39,8 @@ instance ComonadEnv e ((,)e) where ask = fst -#if MIN_VERSION_semigroups(0,16,2) instance ComonadEnv e (Arg e) where ask (Arg e _) = e-#endif lowerAsk :: (ComonadEnv e w, ComonadTrans t) => t w a -> e lowerAsk = ask . lower
src/Control/Comonad/Hoist/Class.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE RankNTypes #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Hoist.Class
src/Control/Comonad/Identity.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Identity
src/Control/Comonad/Store.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Store
src/Control/Comonad/Store/Class.hs view
@@ -1,13 +1,8 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Store.Class@@ -30,9 +25,6 @@ import qualified Control.Comonad.Trans.Store as Store import Control.Comonad.Trans.Traced import Control.Comonad.Trans.Identity-#if __GLASGOW_HASKELL__ < 710-import Data.Semigroup-#endif class Comonad w => ComonadStore s w | w -> s where pos :: w a -> s
src/Control/Comonad/Traced.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Traced
src/Control/Comonad/Traced/Class.hs view
@@ -1,13 +1,8 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Traced.Class@@ -29,9 +24,6 @@ import Control.Comonad.Trans.Store import qualified Control.Comonad.Trans.Traced as Traced import Control.Comonad.Trans.Identity-#if __GLASGOW_HASKELL__ < 710-import Data.Semigroup-#endif class Comonad w => ComonadTraced m w | w -> m where trace :: m -> w a -> a
src/Control/Comonad/Trans/Class.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Trans.Class
src/Control/Comonad/Trans/Env.hs view
@@ -1,13 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-}-#if __GLASGOW_HASKELL__ >= 707-{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable, Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(x,y,z) 1-#endif+{-# LANGUAGE Safe #-}+{-# LANGUAGE StandaloneDeriving #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Trans.Env@@ -62,56 +56,26 @@ , local ) where -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative-#endif import Control.Comonad import Control.Comonad.Hoist.Class import Control.Comonad.Trans.Class-#if __GLASGOW_HASKELL__ < 710-import Data.Foldable-import Data.Traversable-#endif+import Data.Data import Data.Functor.Identity #if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup #endif -#ifdef __GLASGOW_HASKELL__-#if __GLASGOW_HASKELL__ >= 707-#define Typeable1 Typeable-#endif-import Data.Data--#if __GLASGOW_HASKELL__ >= 707-deriving instance Typeable EnvT-#else-instance (Typeable s, Typeable1 w) => Typeable1 (EnvT s w) where- typeOf1 dswa = mkTyConApp envTTyCon [typeOf (s dswa), typeOf1 (w dswa)]- where- s :: EnvT s w a -> s- s = undefined- w :: EnvT s w a -> w a- w = undefined--envTTyCon :: TyCon-#if __GLASGOW_HASKELL__ < 704-envTTyCon = mkTyCon "Control.Comonad.Trans.Env.EnvT"-#else-envTTyCon = mkTyCon3 "comonad-transformers" "Control.Comonad.Trans.Env" "EnvT"-#endif-{-# NOINLINE envTTyCon #-}-+#ifdef __MHS__+import Data.Foldable+import Data.Traversable #endif -#if __GLASGOW_HASKELL__ < 707-instance (Typeable s, Typeable1 w, Typeable a) => Typeable (EnvT s w a) where- typeOf = typeOfDefault-#endif+-- $setup+-- >>> import Control.Comonad instance ( Data e- , Typeable1 w, Data (w a)+ , Typeable w, Data (w a) , Data a ) => Data (EnvT e w a) where gfoldl f z (EnvT e wa) = z EnvT `f` e `f` wa@@ -129,8 +93,6 @@ envTDataType :: DataType envTDataType = mkDataType "Control.Comonad.Trans.Env.EnvT" [envTConstr] {-# NOINLINE envTDataType #-}--#endif type Env e = EnvT e Identity data EnvT e w a = EnvT e (w a)
src/Control/Comonad/Trans/Identity.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Trans.Identity
src/Control/Comonad/Trans/Store.hs view
@@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 707-{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable, Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}-#endif+{-# LANGUAGE Safe #-}+{-# LANGUAGE StandaloneDeriving #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Comonad.Trans.Store@@ -75,9 +72,6 @@ , experiment ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.Comonad.Hoist.Class import Control.Comonad.Trans.Class@@ -86,36 +80,9 @@ import Data.Semigroup #endif -#ifdef __GLASGOW_HASKELL__-import Data.Typeable- -- $setup+-- >>> import Control.Comonad -- >>> import Data.Tuple (swap)--#if __GLASGOW_HASKELL__ >= 707-deriving instance Typeable StoreT-#else-instance (Typeable s, Typeable1 w) => Typeable1 (StoreT s w) where- typeOf1 dswa = mkTyConApp storeTTyCon [typeOf (s dswa), typeOf1 (w dswa)]- where- s :: StoreT s w a -> s- s = undefined- w :: StoreT s w a -> w a- w = undefined--instance (Typeable s, Typeable1 w, Typeable a) => Typeable (StoreT s w a) where- typeOf = typeOfDefault--storeTTyCon :: TyCon-#if __GLASGOW_HASKELL__ < 704-storeTTyCon = mkTyCon "Control.Comonad.Trans.Store.StoreT"-#else-storeTTyCon = mkTyCon3 "comonad-transformers" "Control.Comonad.Trans.Store" "StoreT"-#endif-{-# NOINLINE storeTTyCon #-}-#endif--#endif type Store s = StoreT s Identity
src/Control/Comonad/Trans/Traced.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 707-{-# LANGUAGE StandaloneDeriving, DeriveDataTypeable, Safe #-}-#elif __GLASGOW_HASKELL__ >= 702-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Safe #-}+{-# LANGUAGE StandaloneDeriving #-}+#ifdef MIN_VERSION_indexed_traversable+{-# LANGUAGE MultiParamTypeClasses, UndecidableInstances #-} #endif ----------------------------------------------------------------------------- -- |@@ -36,14 +36,6 @@ , censor ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif--#if __GLASGOW_HASKELL__ < 707-import Control.Monad.Instances ()-#endif- import Control.Monad (ap) import Control.Comonad import Control.Comonad.Hoist.Class@@ -53,13 +45,11 @@ import Data.Distributive #endif -import Data.Functor.Identity--#if __GLASGOW_HASKELL__ < 710-import Data.Semigroup+#ifdef MIN_VERSION_indexed_traversable+import Data.Functor.WithIndex #endif -import Data.Typeable+import Data.Functor.Identity type Traced m = TracedT m Identity@@ -97,6 +87,12 @@ distribute = TracedT . fmap (\tma m -> fmap ($ m) tma) . collect runTracedT #endif +#ifdef MIN_VERSION_indexed_traversable+instance FunctorWithIndex i w => FunctorWithIndex (s, i) (TracedT s w) where+ imap f (TracedT w) = TracedT $ imap (\k' g k -> f (k, k') (g k)) w+ {-# INLINE imap #-}+#endif+ trace :: Comonad w => m -> TracedT m w a -> a trace m (TracedT wf) = extract wf m @@ -108,28 +104,3 @@ censor :: Functor w => (m -> m) -> TracedT m w a -> TracedT m w a censor g = TracedT . fmap (. g) . runTracedT--#ifdef __GLASGOW_HASKELL__--#if __GLASGOW_HASKELL__ >= 707-deriving instance Typeable TracedT-#else-instance (Typeable s, Typeable1 w) => Typeable1 (TracedT s w) where- typeOf1 dswa = mkTyConApp tracedTTyCon [typeOf (s dswa), typeOf1 (w dswa)]- where- s :: TracedT s w a -> s- s = undefined- w :: TracedT s w a -> w a- w = undefined--tracedTTyCon :: TyCon-#if __GLASGOW_HASKELL__ < 704-tracedTTyCon = mkTyCon "Control.Comonad.Trans.Traced.TracedT"-#else-tracedTTyCon = mkTyCon3 "comonad-transformers" "Control.Comonad.Trans.Traced" "TracedT"-#endif-{-# NOINLINE tracedTTyCon #-}--#endif--#endif
src/Data/Functor/Composition.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE Safe #-} module Data.Functor.Composition ( Composition(..) ) where
− tests/doctests.hs
@@ -1,25 +0,0 @@--------------------------------------------------------------------------------- |--- Module : Main (doctests)--- Copyright : (C) 2012-14 Edward Kmett--- License : BSD-style (see the file LICENSE)--- Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : provisional--- Portability : portable------ This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project-------------------------------------------------------------------------------module Main where--import Build_doctests (flags, pkgs, module_sources)-import Data.Foldable (traverse_)-import Test.DocTest--main :: IO ()-main = do- traverse_ putStrLn args- doctest args- where- args = flags ++ pkgs ++ module_sources