free 5.0.2 → 5.1
raw patch · 8 files changed
+91/−35 lines, 8 filesdep ~containersdep ~transformersdep ~transformers-basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers, transformers, transformers-base, transformers-compat
API changes (from Hackage documentation)
- Control.Alternative.Free: instance Data.Semigroup.Semigroup (Control.Alternative.Free.Alt f a)
- Control.Alternative.Free.Final: instance Data.Semigroup.Semigroup (Control.Alternative.Free.Final.Alt f a)
- Control.Comonad.Cofree.Class: instance Control.Comonad.Cofree.Class.ComonadCofree GHC.Base.Maybe Data.List.NonEmpty.NonEmpty
- Control.Comonad.Trans.Cofree: instance (GHC.Classes.Eq (f b), GHC.Classes.Eq a) => GHC.Classes.Eq (Control.Comonad.Trans.Cofree.CofreeF f a b)
- Control.Comonad.Trans.Cofree: instance (GHC.Classes.Ord (f b), GHC.Classes.Ord a) => GHC.Classes.Ord (Control.Comonad.Trans.Cofree.CofreeF f a b)
- Control.Comonad.Trans.Cofree: instance (GHC.Read.Read (f b), GHC.Read.Read a) => GHC.Read.Read (Control.Comonad.Trans.Cofree.CofreeF f a b)
- Control.Comonad.Trans.Cofree: instance (GHC.Show.Show (f b), GHC.Show.Show a) => GHC.Show.Show (Control.Comonad.Trans.Cofree.CofreeF f a b)
- Control.Monad.Trans.Free: instance (GHC.Classes.Eq (f b), GHC.Classes.Eq a) => GHC.Classes.Eq (Control.Monad.Trans.Free.FreeF f a b)
- Control.Monad.Trans.Free: instance (GHC.Classes.Ord (f b), GHC.Classes.Ord a) => GHC.Classes.Ord (Control.Monad.Trans.Free.FreeF f a b)
- Control.Monad.Trans.Free: instance (GHC.Read.Read (f b), GHC.Read.Read a) => GHC.Read.Read (Control.Monad.Trans.Free.FreeF f a b)
- Control.Monad.Trans.Free: instance (GHC.Show.Show (f b), GHC.Show.Show a) => GHC.Show.Show (Control.Monad.Trans.Free.FreeF f a b)
- Control.Monad.Trans.Free.Ap: instance (GHC.Classes.Eq (f b), GHC.Classes.Eq a) => GHC.Classes.Eq (Control.Monad.Trans.Free.Ap.FreeF f a b)
- Control.Monad.Trans.Free.Ap: instance (GHC.Classes.Ord (f b), GHC.Classes.Ord a) => GHC.Classes.Ord (Control.Monad.Trans.Free.Ap.FreeF f a b)
- Control.Monad.Trans.Free.Ap: instance (GHC.Read.Read (f b), GHC.Read.Read a) => GHC.Read.Read (Control.Monad.Trans.Free.Ap.FreeF f a b)
- Control.Monad.Trans.Free.Ap: instance (GHC.Show.Show (f b), GHC.Show.Show a) => GHC.Show.Show (Control.Monad.Trans.Free.Ap.FreeF f a b)
- Control.Monad.Trans.Iter: instance (GHC.Base.Monad m, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Control.Monad.Trans.Iter.IterT m a)
- Control.Monad.Trans.Iter: instance (GHC.Base.Monad m, Data.Semigroup.Semigroup a, GHC.Base.Monoid a) => GHC.Base.Monoid (Control.Monad.Trans.Iter.IterT m a)
+ Control.Alternative.Free: instance GHC.Base.Semigroup (Control.Alternative.Free.Alt f a)
+ Control.Alternative.Free.Final: instance GHC.Base.Semigroup (Control.Alternative.Free.Final.Alt f a)
+ Control.Comonad.Cofree.Class: instance Control.Comonad.Cofree.Class.ComonadCofree GHC.Base.Maybe GHC.Base.NonEmpty
+ Control.Comonad.Trans.Cofree: instance (GHC.Classes.Eq a, GHC.Classes.Eq (f b)) => GHC.Classes.Eq (Control.Comonad.Trans.Cofree.CofreeF f a b)
+ Control.Comonad.Trans.Cofree: instance (GHC.Classes.Ord a, GHC.Classes.Ord (f b)) => GHC.Classes.Ord (Control.Comonad.Trans.Cofree.CofreeF f a b)
+ Control.Comonad.Trans.Cofree: instance (GHC.Read.Read a, GHC.Read.Read (f b)) => GHC.Read.Read (Control.Comonad.Trans.Cofree.CofreeF f a b)
+ Control.Comonad.Trans.Cofree: instance (GHC.Show.Show a, GHC.Show.Show (f b)) => GHC.Show.Show (Control.Comonad.Trans.Cofree.CofreeF f a b)
+ Control.Monad.Trans.Free: instance (GHC.Classes.Eq a, GHC.Classes.Eq (f b)) => GHC.Classes.Eq (Control.Monad.Trans.Free.FreeF f a b)
+ Control.Monad.Trans.Free: instance (GHC.Classes.Ord a, GHC.Classes.Ord (f b)) => GHC.Classes.Ord (Control.Monad.Trans.Free.FreeF f a b)
+ Control.Monad.Trans.Free: instance (GHC.Read.Read a, GHC.Read.Read (f b)) => GHC.Read.Read (Control.Monad.Trans.Free.FreeF f a b)
+ Control.Monad.Trans.Free: instance (GHC.Show.Show a, GHC.Show.Show (f b)) => GHC.Show.Show (Control.Monad.Trans.Free.FreeF f a b)
+ Control.Monad.Trans.Free.Ap: instance (GHC.Classes.Eq a, GHC.Classes.Eq (f b)) => GHC.Classes.Eq (Control.Monad.Trans.Free.Ap.FreeF f a b)
+ Control.Monad.Trans.Free.Ap: instance (GHC.Classes.Ord a, GHC.Classes.Ord (f b)) => GHC.Classes.Ord (Control.Monad.Trans.Free.Ap.FreeF f a b)
+ Control.Monad.Trans.Free.Ap: instance (GHC.Read.Read a, GHC.Read.Read (f b)) => GHC.Read.Read (Control.Monad.Trans.Free.Ap.FreeF f a b)
+ Control.Monad.Trans.Free.Ap: instance (GHC.Show.Show a, GHC.Show.Show (f b)) => GHC.Show.Show (Control.Monad.Trans.Free.Ap.FreeF f a b)
+ Control.Monad.Trans.Iter: instance (GHC.Base.Monad m, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Control.Monad.Trans.Iter.IterT m a)
+ Control.Monad.Trans.Iter: instance (GHC.Base.Monad m, GHC.Base.Semigroup a, GHC.Base.Monoid a) => GHC.Base.Monoid (Control.Monad.Trans.Iter.IterT m a)
- Control.Alternative.Free.Final: Alt :: (forall g. Alternative g => (forall x. f x -> g x) -> g a) -> Alt f a
+ Control.Alternative.Free.Final: Alt :: forall g. Alternative g => (forall x. f x -> g x) -> g a -> Alt f a
- Control.Applicative.Free.Fast: Ap :: (forall u y z. (forall x. (x -> y) -> ASeq f x -> z) -> (u -> a -> y) -> ASeq f u -> z) -> Ap f a
+ Control.Applicative.Free.Fast: Ap :: forall u y z. (forall x. (x -> y) -> ASeq f x -> z) -> (u -> a -> y) -> ASeq f u -> z -> Ap f a
- Control.Applicative.Free.Final: Ap :: (forall g. Applicative g => (forall x. f x -> g x) -> g a) -> Ap f a
+ Control.Applicative.Free.Final: Ap :: forall g. Applicative g => (forall x. f x -> g x) -> g a -> Ap f a
- Control.Monad.Free: _Free :: forall f m a p. (Choice p, Applicative m) => p (f (Free f a)) (m (f (Free f a))) -> p (Free f a) (m (Free f a))
+ Control.Monad.Free: _Free :: forall f g m a p. (Choice p, Applicative m) => p (f (Free f a)) (m (g (Free g a))) -> p (Free f a) (m (Free g a))
- Control.Monad.Free.Church: F :: (forall r. (a -> r) -> (f r -> r) -> r) -> F f a
+ Control.Monad.Free.Church: F :: forall r. (a -> r) -> (f r -> r) -> r -> F f a
- Control.Monad.Trans.Free.Church: FT :: (forall r. (a -> m r) -> (forall x. (x -> m r) -> f x -> m r) -> m r) -> FT f m a
+ Control.Monad.Trans.Free.Church: FT :: forall r. (a -> m r) -> (forall x. (x -> m r) -> f x -> m r) -> m r -> FT f m a
Files
- .travis.yml +34/−21
- CHANGELOG.markdown +10/−0
- examples/ValidationForm.hs +4/−1
- examples/free-examples.cabal +8/−1
- free.cabal +24/−8
- include/free-common.h +4/−0
- src/Control/Monad/Free.hs +4/−4
- src/Control/Monad/Free/TH.hs +3/−0
.travis.yml view
@@ -1,6 +1,6 @@ # This Travis job script has been generated by a script via #-# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-installed' 'cabal.project'+# 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 #@@ -36,33 +36,37 @@ matrix: include:- - compiler: "ghc-7.4.2"+ - 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.0,ghc-7.4.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.6.3"+ 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.0,ghc-7.6.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.8.4"+ 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.0,ghc-7.8.4], sources: [hvr-ghc]}}+ 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.0,ghc-7.10.3], sources: [hvr-ghc]}}- - compiler: "ghc-8.0.2"+ 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.0,ghc-8.0.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.2.2"+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}+ - compiler: "ghc-7.6.3" # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.2"+ 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-8.4.2], sources: [hvr-ghc]}}+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], 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-8.6.1" before_install: - HC=${CC}@@ -80,7 +84,8 @@ - BENCH=${BENCH---enable-benchmarks} - TEST=${TEST---enable-tests} - HADDOCK=${HADDOCK-true}- - INSTALLED=${INSTALLED-true}+ - UNCONSTRAINED=${UNCONSTRAINED-true}+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false} - GHCHEAD=${GHCHEAD-false} - travis_retry cabal update -v - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"@@ -88,7 +93,8 @@ # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage - | if $GHCHEAD; then- sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config+ 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@@ -98,13 +104,18 @@ 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" - echo 'package free-examples' >> cabal.project - "echo ' flags: -mandelbrot-iter' >> cabal.project"- - cat 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@@ -113,7 +124,7 @@ fi - rm -f cabal.project.freeze - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all- - rm -rf "."/.ghc.environment.* "./examples"/.ghc.environment.* "."/dist "./examples"/dist+ - 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;@@ -128,8 +139,10 @@ - "printf 'packages: free-*/*.cabal free-examples-*/*.cabal\\n' > cabal.project" - echo 'package free-examples' >> cabal.project - "echo ' flags: -mandelbrot-iter' >> cabal.project"- - cat 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@@ -142,5 +155,5 @@ - 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","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]+# 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,13 @@+5.1 [2018.07.03]+----------------+* Generalize the type of `_Free`.+* Allow building with `containers-0.6`.+* Avoid incurring some dependencies when using recent GHCs.++5.0.2 [2018.04.25]+------------------+* Add `Generic` and `Generic1` instances where possible.+ 5.0.1 [2018.03.07] ------------------ * Fix the build on old GHCs with `transformers-0.4`.
examples/ValidationForm.hs view
@@ -1,10 +1,13 @@+{-# LANGUAGE CPP #-} module Main where +#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative+#endif import Control.Applicative.Free import Control.Monad.State -import Data.Monoid+import Data.Monoid (Sum(..)) import Text.Read.Compat (readEither) import Text.Printf
examples/free-examples.cabal view
@@ -10,7 +10,14 @@ homepage: http://github.com/ekmett/free/ bug-reports: http://github.com/ekmett/free/issues copyright: Copyright (C) 2008-2015 Edward A. Kmett-tested-with: 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.2+tested-with: 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 synopsis: Monads for free description: Examples projects using @free@ build-type: Simple
free.cabal view
@@ -1,8 +1,8 @@ name: free category: Control, Monads-version: 5.0.2+version: 5.1 license: BSD3-cabal-version: >= 1.18+cabal-version: 1.18 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -10,7 +10,14 @@ homepage: http://github.com/ekmett/free/ bug-reports: http://github.com/ekmett/free/issues copyright: Copyright (C) 2008-2015 Edward A. Kmett-tested-with: 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.2+tested-with: 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 synopsis: Monads for free description: Free monads are useful for many tree-like structures and domain specific languages.@@ -73,19 +80,28 @@ build-depends: base == 4.*,- bifunctors >= 4 && < 6, comonad >= 4 && < 6, distributive >= 0.2.1, mtl >= 2.0.1.0 && < 2.3, profunctors >= 4 && < 6, semigroupoids >= 4 && < 6,- semigroups >= 0.8.3.1 && < 1, transformers >= 0.2.0 && < 0.6,- transformers-base < 0.5,- transformers-compat >= 0.3 && < 1,+ transformers-base >= 0.4 && < 0.5, template-haskell >= 2.7.0.0 && < 3, exceptions >= 0.6 && < 0.11,- containers < 0.6+ containers < 0.7++ if !impl(ghc >= 8.2)+ build-depends: bifunctors >= 4 && < 6++ if !impl(ghc >= 8.0)+ build-depends: semigroups >= 0.8.3.1 && < 1++ -- Ensure Data.Functor.Classes is always available+ if impl(ghc >= 7.10)+ build-depends: transformers >= 0.4.2.0+ else+ build-depends: transformers-compat >= 0.5.1.0 && <0.7 exposed-modules: Control.Applicative.Free
include/free-common.h view
@@ -6,6 +6,10 @@ #define MIN_VERSION_mtl(x,y,z) 1 #endif +#ifndef MIN_VERSION_transformers_compat+#define MIN_VERSION_transformers_compat(x,y,z) 0+#endif+ #if MIN_VERSION_base(4,9,0) #define LIFTED_FUNCTOR_CLASSES 1 #else
src/Control/Monad/Free.hs view
@@ -413,19 +413,19 @@ {-# INLINE impure #-} {-# INLINE _Pure #-} --- | This is @Prism' (Free f a) (f (Free f a))@ in disguise+-- | This is @Prism (Free f a) (Free g a) (f (Free f a)) (g (Free g a))@ in disguise -- -- >>> preview _Free (review _Free (Just (Pure 3))) -- Just (Just (Pure 3)) -- -- >>> review _Free (Just (Pure 3)) -- Free (Just (Pure 3))-_Free :: forall f m a p. (Choice p, Applicative m)- => p (f (Free f a)) (m (f (Free f a))) -> p (Free f a) (m (Free f a))+_Free :: forall f g m a p. (Choice p, Applicative m)+ => p (f (Free f a)) (m (g (Free g a))) -> p (Free f a) (m (Free g a)) _Free = dimap unfree (either pure (fmap Free)) . right' where unfree (Free x) = Right x- unfree x = Left x+ unfree (Pure x) = Left (Pure x) {-# INLINE unfree #-} {-# INLINE _Free #-}
src/Control/Monad/Free/TH.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -Wno-overlapping-patterns #-}+#endif #include "free-common.h" -----------------------------------------------------------------------------