packages feed

arrow-list 0.7 → 0.7.1

raw patch · 4 files changed

+30/−15 lines, 4 filesdep +faildep ~containers

Dependencies added: fail

Dependency ranges changed: containers

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog +### 0.7.1++* Fix compilation with GHC 8.8.+ ## 0.7  * Renamed modules to not clash with hxt
arrow-list.cabal view
@@ -1,5 +1,5 @@ name:                arrow-list-version:             0.7+version:             0.7.1 synopsis:            List arrows for Haskell. description:   This small Haskell library provides some type class, types and functions to@@ -15,7 +15,7 @@ bug-reports:         https://github.com/silkapp/arrow-list/issues license-file:        LICENSE build-type:          Simple-cabal-version:       >= 1.6+cabal-version:       >= 1.10  extra-source-files:   CHANGELOG.md@@ -38,5 +38,7 @@     Control.Monad.Sequence   build-depends:       base ==4.*-    , containers >= 0.3 && < 0.6+    , containers >= 0.3 && < 0.7+    , fail == 4.9.*     , mtl >= 1.1 && < 2.3+  default-language: Haskell2010
src/Control/Arrow/ListLike/Class.hs view
@@ -37,18 +37,19 @@ ) where +import Prelude hiding (const, id, (.))+ import Control.Applicative hiding (optional) import Control.Arrow import Control.Arrow.Kleisli.Class import Control.Category-import Data.Foldable (Foldable, toList)-import Prelude hiding (const, id, (.))+import qualified Data.Foldable as F import qualified Prelude  -- | A type class for arrows that produce containers of results. The container -- arrow can be seen as a generalization for list arrows. Most operations -- assume the container type has an 'Applicative', an 'Alternative' and a--- 'Foldable' instance.+-- 'F.Foldable' instance.  class Arrow arr => ArrowListLike f arr | arr -> f where   embed   :: f a `arr` a                 -- ^ Use a container as the input for an arrow.@@ -98,8 +99,8 @@ -- | Returns a `Bool' indicating whether the input arrow produces a container -- with any results. -results :: (Foldable f, ArrowListLike f arr) => (a `arr` b) -> (a `arr` Bool)-results a = arr (not . null . toList) . observe a+results :: (F.Foldable f, ArrowListLike f arr) => (a `arr` b) -> (a `arr` Bool)+results a = arr (not . null . F.toList) . observe a  -- | Create a filtering container arrow by mapping a predicate function over the -- input. When the predicate returns `True' the input will be returned in the@@ -113,7 +114,7 @@ -- used, when the first arrow produces no results the /else/ arrow will be -- used. -ifA :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` t) -> (a `arr` t) -> a `arr` t+ifA :: (F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` t) -> (a `arr` t) -> a `arr` t ifA c t e = proc i -> do x <- results c -< i; if x then t -< i else e -< i  -- | Apply a container arrow only when a conditional arrow produces any@@ -123,7 +124,7 @@  infix 7 `when` -when :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` a) -> (a `arr` c) -> a `arr` a+when :: (F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` a) -> (a `arr` c) -> a `arr` a when a c = ifA c a id  -- | Apply a container arrow only when a conditional arrow produces any@@ -133,19 +134,19 @@  infix 8 `guards` -guards :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> (a `arr` b) -> (a `arr` b)+guards :: (Alternative f, F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> (a `arr` b) -> (a `arr` b) guards c a = ifA c a none  -- | Filter the results of an arrow with a predicate arrow, when the filter -- condition produces results the input is accepted otherwise it is excluded. -filterA :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a+filterA :: (Alternative f, F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a filterA c = ifA c id none  -- | Negation container arrow. Only accept the input when the condition -- produces no output. -notA :: (Alternative f, Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a+notA :: (Alternative f, F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` c) -> a `arr` a notA c = ifA c none id  -- | Apply the input arrow, when the arrow does not produces any results the@@ -154,7 +155,7 @@  infix 6 `orElse` -orElse :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b+orElse :: (F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> (a `arr` b) -> a `arr` b orElse a = ifA a a  -- | Map a `Maybe' input to a container output. When the Maybe is a `Nothing'@@ -168,5 +169,5 @@ -- returned, otherwise the results will be wrapped in a `Just'. This function -- always produces result. -optional :: (Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> a `arr` Maybe b+optional :: (F.Foldable f, ArrowListLike f arr, ArrowChoice arr) => (a `arr` b) -> a `arr` Maybe b optional a = ifA a (arr Just . a) (arr (const Nothing))
src/Control/Monad/Sequence.hs view
@@ -10,6 +10,9 @@  import Control.Applicative import Control.Monad hiding (mapM, msum)+#if !MIN_VERSION_base(4,13,0)+import Control.Monad.Fail+#endif import Control.Monad.Trans import Data.Foldable import Data.Monoid@@ -54,6 +57,11 @@     do a <- runSeqT m        b <- mapM (runSeqT . k) a        return (msum b)+  #if !MIN_VERSION_base(4,13,0)+  fail _ = SeqT (return mempty)+  #endif++instance Monad m => MonadFail (SeqT m) where   fail _ = SeqT (return mempty)  instance Monad m => MonadPlus (SeqT m) where