machines 0.7.3 → 0.7.4
raw patch · 12 files changed
+38/−90 lines, 12 filesdep −faildep ~basedep ~containersdep ~mtl
Dependencies removed: fail
Dependency ranges changed: base, containers, mtl, profunctors
Files
- CHANGELOG.markdown +4/−0
- examples/Examples.hs +6/−6
- examples/machines-examples.cabal +8/−7
- machines.cabal +19/−21
- src/Data/Machine/Fanout.hs +0/−5
- src/Data/Machine/Mealy.hs +0/−7
- src/Data/Machine/MealyT.hs +0/−3
- src/Data/Machine/Moore.hs +0/−5
- src/Data/Machine/MooreT.hs +0/−10
- src/Data/Machine/Plan.hs +0/−9
- src/Data/Machine/Process.hs +1/−10
- src/Data/Machine/Runner.hs +0/−7
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.7.4 [2025.03.03]+------------------+* Drop support for pre-8.0 versions of GHC.+ 0.7.3 [2022.05.18] ------------------ * Allow building with `mtl-2.3.*` and `transformers-0.6.*`.
examples/Examples.hs view
@@ -1,11 +1,7 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} module Examples where -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative-#endif import Control.Exception import Control.Monad.Trans import Data.Machine@@ -58,12 +54,16 @@ -- | lineCount counts the number of lines in a file lineCount :: FilePath -> IO Int-lineCount path = head <$> (runT src) where+lineCount path = runHead src where src = getFileLines path (fold (\a _ -> a + 1) 0) -- | run a machine and just take the first value out of it. runHead :: (Functor f, Monad f) => MachineT f k b -> f b-runHead src = head <$> runT src+runHead src = do+ vs <- runT src+ case vs of+ v:_ -> return v+ [] -> error "No values from machine" -- | lineCharCount counts the number of lines, and characters in a file lineCharCount :: FilePath -> IO (Int, Int)
examples/machines-examples.cabal view
@@ -16,18 +16,19 @@ @machines@ examples build-type: Simple-tested-with: GHC == 7.4.2- , GHC == 7.6.3- , GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+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.2+ , GHC == 9.2.8+ , GHC == 9.4.8+ , GHC == 9.6.6+ , GHC == 9.8.4+ , GHC == 9.10.1+ , GHC == 9.12.1 source-repository head type: git@@ -35,7 +36,7 @@ library build-depends:- base == 4.*,+ base >= 4.9 && < 5, machines == 0.7.*, mtl >= 2 && < 2.4
machines.cabal view
@@ -1,6 +1,6 @@ name: machines category: Control, Enumerator-version: 0.7.3+version: 0.7.4 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -17,18 +17,19 @@ Rúnar Bjarnason's talk on machines can be downloaded from: <http://web.archive.org/web/20161029161813/https://dl.dropboxusercontent.com/u/4588997/Machines.pdf> build-type: Simple-tested-with: GHC == 7.4.2- , GHC == 7.6.3- , GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+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.2+ , GHC == 9.2.8+ , GHC == 9.4.8+ , GHC == 9.6.6+ , GHC == 9.8.4+ , GHC == 9.10.1+ , GHC == 9.12.1 extra-source-files: .gitignore .vim.custom@@ -41,22 +42,22 @@ source-repository head type: git- location: git://github.com/ekmett/machines.git+ location: https://github.com/ekmett/machines.git library build-depends: adjunctions >= 4.2 && < 5,- base >= 4.5 && < 5,+ base >= 4.9 && < 5, comonad >= 3 && < 6,- containers >= 0.3 && < 0.7,+ containers >= 0.3 && < 0.9, distributive < 0.7, pointed >= 3 && < 6,- profunctors >= 3 && < 6,- semigroupoids >= 5 && < 6,+ profunctors >= 4 && < 6,+ semigroupoids >= 5 && < 7, semigroups >= 0.8.3 && < 1, transformers >= 0.3 && < 0.7, transformers-compat >= 0.3,- mtl >= 2 && < 2.4,+ mtl >= 2.2 && < 2.4, void >= 0.6.1 && < 1 exposed-modules:@@ -88,15 +89,12 @@ Rank2Types UndecidableInstances - ghc-options: -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields+ ghc-options: -Wall -Wtabs -O2 -fdicts-cheap -funbox-strict-fields -- See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#base-4.9.0.0- if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wnoncanonical-monad-instances- if !impl(ghc >= 8.8)- ghc-options: -Wnoncanonical-monadfail-instances- else- build-depends: fail == 4.9.*+ ghc-options: -Wcompat -Wnoncanonical-monad-instances+ if !impl(ghc >= 8.8)+ ghc-options: -Wnoncanonical-monadfail-instances hs-source-dirs: src @@ -110,7 +108,7 @@ build-depends: base >= 4.9 && < 5, conduit >= 1.3 && < 1.4,- criterion >= 0.6 && < 1.6,+ criterion >= 0.6 && < 1.7, machines, mtl >= 2 && < 2.4, pipes >= 4 && < 4.4,
src/Data/Machine/Fanout.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -9,10 +8,6 @@ import Data.List.NonEmpty (NonEmpty (..)) import Data.Machine import Data.Semigroup (Semigroup (sconcat))-#if __GLASGOW_HASKELL__ < 710-import Data.Monoid (Monoid (..))-import Data.Traversable (traverse)-#endif continue :: ([b] -> r) -> [(a -> b, b)] -> Step (Is a) o r continue _ [] = Stop
src/Data/Machine/Mealy.hs view
@@ -2,9 +2,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} -#ifndef MIN_VERSION_profunctors-#define MIN_VERSION_profunctors(x,y,z) 0-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Machine.Mealy@@ -97,12 +94,10 @@ go (Mealy m) = Mealy $ \a -> case m (f a) of (b, n) -> (b, go n) {-# INLINE lmap #-}-#if MIN_VERSION_profunctors(3,1,1) dimap f g = go where go (Mealy m) = Mealy $ \a -> case m (f a) of (b, n) -> (g b, go n) {-# INLINE dimap #-}-#endif instance Automaton Mealy where auto x = construct $ go x where@@ -144,14 +139,12 @@ Right b -> case runMealy n b of (d, n') -> (d, m ||| n') -#if MIN_VERSION_profunctors(3,2,0) instance Strong Mealy where first' = first instance Choice Mealy where left' = left right' = right-#endif -- | Fast forward a mealy machine forward driveMealy :: Mealy a b -> Seq a -> a -> (b, Mealy a b)
src/Data/Machine/MealyT.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} -----------------------------------------------------------------------------@@ -54,11 +53,9 @@ lmap f = go where go (MealyT m) = MealyT $ \a -> fmap (\(b,n) -> (b, go n)) (m (f a)) {-# INLINE lmap #-}-#if MIN_VERSION_profunctors(3,1,1) dimap f g = go where go (MealyT m) = MealyT $ \a -> fmap (\(b,n) -> (g b, go n)) (m (f a)) {-# INLINE dimap #-}-#endif instance Monad m => C.Category (MealyT m) where {-# INLINE id #-}
src/Data/Machine/Moore.hs view
@@ -2,9 +2,6 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} -#ifndef MIN_VERSION_profunctors-#define MIN_VERSION_profunctors(x,y,z) 0-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Machine.Moore@@ -77,11 +74,9 @@ lmap f = go where go (Moore b g) = Moore b (go . g . f) {-# INLINE lmap #-}-#if MIN_VERSION_profunctors(3,1,1) dimap f g = go where go (Moore b h) = Moore (g b) (go . h . f) {-# INLINE dimap #-}-#endif instance Applicative (Moore a) where pure a = r where r = Moore a (const r)
src/Data/Machine/MooreT.hs view
@@ -1,9 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} -#ifndef MIN_VERSION_profunctors-#define MIN_VERSION_profunctors(x,y,z) 0-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Machine.MooreT@@ -33,11 +30,6 @@ import Data.Pointed (Pointed(..)) import Data.Profunctor (Costrong(..), Profunctor(..)) -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative-import Data.Monoid (Monoid(..))-#endif- #if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..)) #endif@@ -96,10 +88,8 @@ {-# INLINE rmap #-} lmap f = let go = MooreT . fmap (\(b, m') -> (b, go . m' . f)) . runMooreT in go {-# INLINE lmap #-}-#if MIN_VERSION_profunctors(3,1,1) dimap f g = let go = MooreT . fmap (\(b, m') -> (g b, go . m' . f)) . runMooreT in go {-# INLINE dimap #-}-#endif instance Applicative m => Applicative (MooreT m a) where pure x = let r = MooreT $ pure (x, const r) in r
src/Data/Machine/Plan.hs view
@@ -3,9 +3,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-}-#ifndef MIN_VERSION_mtl-#define MIN_VERSION_mtl(x,y,z) 0-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Machine.Plan@@ -144,22 +141,16 @@ {-# INLINE get #-} put = lift . put {-# INLINE put #-}-#if MIN_VERSION_mtl(2,1,0) state f = PlanT $ \kp _ _ _ -> state f >>= kp {-# INLINE state #-}-#endif instance MonadReader e m => MonadReader e (PlanT k o m) where ask = lift ask-#if MIN_VERSION_mtl(2,1,0) reader = lift . reader-#endif local f m = PlanT $ \kp ke kr kf -> local f (runPlanT m kp ke kr kf) instance MonadWriter w m => MonadWriter w (PlanT k o m) where-#if MIN_VERSION_mtl(2,1,0) writer = lift . writer-#endif tell = lift . tell listen m = PlanT $ \kp ke kr kf -> runPlanT m ((kp =<<) . listen . return) ke kr kf
src/Data/Machine/Process.hs view
@@ -1,11 +1,7 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ScopedTypeVariables #-}-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(x,y,z) 0-#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Machine.Process@@ -68,12 +64,7 @@ import Data.Machine.Type import Data.Monoid import Data.Void-import Prelude-#if !(MIN_VERSION_base(4,8,0))- hiding (id, (.), foldr)-#else- hiding (id, (.))-#endif+import Prelude hiding (id, (.)) -- $setup -- >>> import Data.Machine
src/Data/Machine/Runner.hs view
@@ -1,8 +1,4 @@ {-# LANGUAGE BangPatterns #-}-{-# LANGUAGE CPP #-}-#ifndef MIN_VERSION_base-#define MIN_VERSION_base(x,y,z) 0-#endif module Data.Machine.Runner ( foldrT , foldlT@@ -16,9 +12,6 @@ import Data.Machine.Type import Control.Monad (liftM)-#if !MIN_VERSION_base (4,8,0)-import Data.Monoid (Monoid (..))-#endif -- | Right fold over a stream. This will be lazy if the underlying -- monad is.