box 0.9.0 → 0.9.1
raw patch · 6 files changed
+16/−24 lines, 6 filesdep −transformersdep ~mtldep ~timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: transformers
Dependency ranges changed: mtl, time
API changes (from Hackage documentation)
- Box.Codensity: instance (GHC.Base.Functor m, GHC.Base.Semigroup a, GHC.Base.Monoid a) => GHC.Base.Monoid (Control.Monad.Codensity.Codensity m a)
+ Box.Codensity: instance (GHC.Base.Functor m, GHC.Base.Monoid a) => GHC.Base.Monoid (Control.Monad.Codensity.Codensity m a)
- Box.Box: class Profunctor p => DecAlt p
+ Box.Box: class (Profunctor p) => DecAlt p
Files
- box.cabal +6/−7
- src/Box/Box.hs +3/−3
- src/Box/Codensity.hs +1/−1
- src/Box/Connectors.hs +2/−4
- src/Box/IO.hs +4/−4
- src/Box/Queue.hs +0/−5
box.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: box-version: 0.9.0+version: 0.9.1 synopsis: boxes description: A profunctor effect category: project@@ -12,7 +12,8 @@ license: BSD-3-Clause license-file: LICENSE build-type: Simple-tested-with: GHC ==8.8.4 || ==8.10.7 || ==9.2.2+tested-with:+ GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.2.5 || ==9.4.4 extra-source-files: ChangeLog.md source-repository head@@ -37,8 +38,7 @@ ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints- -funbox-strict-fields -fwrite-ide-info -hiedir=.hie- -Wunused-packages+ -funbox-strict-fields build-depends: , async ^>= 2.2@@ -49,12 +49,11 @@ , dlist ^>=1.0 , exceptions ^>=0.10 , kan-extensions ^>=5.2- , mtl ^>=2.2.2+ , mtl >=2.2.2 && <2.4 , profunctors ^>=5.6 , semigroupoids ^>=5.3 , stm ^>= 2.5.1 , text >=1.2 && < 2.1- , time ^>=1.9- , transformers ^>=0.5+ , time >=1.9 && <1.13 default-language: Haskell2010
src/Box/Box.hs view
@@ -121,7 +121,7 @@ -- >>> glueN 4 (witherC (\x -> bool (pure Nothing) (pure (Just x)) (even x)) showStdout) <$|> qList [0..9] -- 0 -- 2-glueN :: Monad m => Int -> Committer m a -> Emitter m a -> m ()+glueN :: (Monad m) => Int -> Committer m a -> Emitter m a -> m () glueN n c e = flip evalStateT 0 $ glue (foist lift c) (takeE n e) -- | Glue a Committer to an Emitter within a box.@@ -146,7 +146,7 @@ conpur a = Box conquer (pure a) -- | combines 'Decidable' and 'Alternative'-class Profunctor p => DecAlt p where+class (Profunctor p) => DecAlt p where choice :: (a -> Either b c) -> (Either d e -> f) -> p b d -> p c e -> p a f loss :: p Void b @@ -175,7 +175,7 @@ seqBox = Box push pop -- | cps composition of monadic boxes-dotco :: Monad m => Codensity m (Box m a b) -> Codensity m (Box m b c) -> Codensity m (Box m a c)+dotco :: (Monad m) => Codensity m (Box m a b) -> Codensity m (Box m b c) -> Codensity m (Box m a c) dotco b b' = lift $ do (Box c e) <- lowerCodensity b (Box c' e') <- lowerCodensity b'
src/Box/Codensity.hs view
@@ -28,7 +28,7 @@ instance (Semigroup a) => Semigroup (Codensity m a) where (<>) = liftA2 (<>) -instance (Functor m, Semigroup a, Monoid a) => Monoid (Codensity m a) where+instance (Functor m, Monoid a) => Monoid (Codensity m a) where mempty = pure mempty mappend = (<>)
src/Box/Connectors.hs view
@@ -68,7 +68,7 @@ -- 1 -- 2 -- 3-popList :: Monad m => [a] -> Committer m a -> m ()+popList :: (Monad m) => [a] -> Committer m a -> m () popList xs c = glueES (Seq.fromList xs) c pop -- | Push an Emitter into a list, via push.@@ -89,9 +89,7 @@ sink1 :: (Monad m) => (a -> m ()) -> Emitter m a -> m () sink1 f e = do a <- emit e- case a of- Nothing -> pure ()- Just a' -> f a'+ forM_ a f -- FIXME: This doctest sometimes fails with the last value not being printed. Hypothesis: the pipe collapses before the console print effect happens.
src/Box/IO.hs view
@@ -112,7 +112,7 @@ -- hippo -- 2 -- 2-readStdin :: Read a => Emitter IO a+readStdin :: (Read a) => Emitter IO a readStdin = witherE (pure . either (const Nothing) Just) . readE $ fromStdin -- | Show to stdout@@ -121,7 +121,7 @@ -- 1 -- 2 -- 3-showStdout :: Show a => Committer IO a+showStdout :: (Show a) => Committer IO a showStdout = contramap (Text.pack . show) toStdout -- | Emits lines of Text from a handle.@@ -216,14 +216,14 @@ pure e -- | simple console logger for rough testing-logConsoleE :: Show a => String -> Emitter IO a -> Emitter IO a+logConsoleE :: (Show a) => String -> Emitter IO a -> Emitter IO a logConsoleE label e = Emitter $ do a <- emit e Prelude.putStrLn (label <> show a) pure a -- | simple console logger for rough testing-logConsoleC :: Show a => String -> Committer IO a -> Committer IO a+logConsoleC :: (Show a) => String -> Committer IO a -> Committer IO a logConsoleC label c = Committer $ \a -> do Prelude.putStrLn (label <> show a) commit c a
src/Box/Queue.hs view
@@ -181,8 +181,6 @@ ) -- | Create an unbounded queue, returning the result from the Committer action.------ >>> queueL New (\c -> glue c <$|> qList [1..3]) toListM queueL :: Queue a -> (Committer IO a -> IO l) ->@@ -191,9 +189,6 @@ queueL q cm em = withQL q toBoxM cm em -- | Create an unbounded queue, returning the result from the Emitter action.------ >>> queueR New (\c -> glue c <$|> qList [1..3]) toListM--- [3] queueR :: Queue a -> (Committer IO a -> IO l) ->