packages feed

box 0.0.1.4 → 0.0.1.5

raw patch · 6 files changed

+11/−18 lines, 6 filesdep −data-defaultdep −flow

Dependencies removed: data-default, flow

Files

box.cabal view
@@ -1,5 +1,5 @@ name:           box-version:        0.0.1.4+version:        0.0.1.5 synopsis:       boxes description:    concurrent, effectful boxes category:       project@@ -48,9 +48,7 @@     , base >=4.7 && <5     , concurrency     , contravariant-    , data-default     , exceptions-    , flow     , foldl     , lens     , pipes
src/Box/Control.hs view
@@ -29,7 +29,6 @@ import Control.Lens hiding ((|>)) import Control.Monad import Data.Data-import Flow import GHC.Generics import Protolude hiding ((.), STM) import Text.Read (readMaybe)@@ -150,4 +149,4 @@  timeOut :: Double -> ControlBox m timeOut t =-  Box <$> mempty <*> ((lift (sleep t) >> S.yield Stop) |> toEmit)+  Box <$> mempty <*> ((lift (sleep t) >> S.yield Stop) & toEmit)
src/Box/IO.hs view
@@ -43,7 +43,6 @@ import Box.Plugs import Box.Stream import Box.Transducer-import Flow import Protolude hiding ((.), (<>), STM) import Streaming (Of(..), Stream) import qualified Streaming.Internal as S@@ -69,7 +68,7 @@  -- | a Cont stdin emitter eStdin :: Int -> Cont IO (Emitter (STM IO) Text)-eStdin n = cStdin n |> emitPlug+eStdin n = cStdin n & emitPlug  -- | read from console, throwing away read errors readStdin :: Read a => Cont IO (Emitter (STM IO) a)@@ -105,7 +104,7 @@  -- | a Cont stdout committer cStdout :: Print a => Int -> Cont IO (Committer (STM IO) a)-cStdout n = eStdout n |> commitPlug+cStdout n = eStdout n & commitPlug  -- | show to stdout showStdout :: Show a => Cont IO (Committer (STM IO) a)@@ -119,7 +118,7 @@ -- * file operations -- | emit lines from a file emitLines :: FilePath -> Cont IO (Emitter (STM IO) Text)-emitLines filePath = Cont (withFile filePath ReadMode) >>= fromHandle .> toEmit+emitLines filePath = Cont (withFile filePath ReadMode) >>= (fromHandle >>> toEmit)   where     fromHandle :: Handle -> Stream (Of Text) IO ()     fromHandle h =@@ -130,7 +129,7 @@ -- | commit lines to a file commitLines :: FilePath -> Cont IO (Committer (STM IO) Text) commitLines filePath =-  Cont (withFile filePath WriteMode) >>= toHandle .> toCommit+  Cont (withFile filePath WriteMode) >>= (toHandle >>> toCommit)   where     toHandle h = loop       where
src/Box/Stream.hs view
@@ -29,8 +29,6 @@ import Box.Cont import Box.Emitter import Box.Queue--- import Box.Transducer-import Flow import Streaming (Of(..), Stream) import qualified Control.Foldl as L import qualified Streaming.Prelude as S@@ -65,7 +63,7 @@ -- todo: look at biases queueStream ::      (MonadConc m) => Stream (Of a) m () -> Cont m (Stream (Of a) m ())-queueStream i = Cont $ \o -> queueE (fromStream i) (toStream .> o)+queueStream i = Cont $ \o -> queueE (fromStream i) (toStream >>> o)  -- | turn an emitter into a stream toStream :: (MonadConc m) => Emitter (STM m) a -> Stream (Of a) m ()
src/Box/Transducer.hs view
@@ -25,7 +25,6 @@ import Box.Cont import Box.Emitter import Box.Stream-import Flow import qualified Pipes import qualified Pipes.Prelude as Pipes import Protolude hiding ((.), (<>))@@ -61,12 +60,12 @@ etc :: (MonadConc m) => s -> Transducer s a b -> Cont m (Box (C.STM m) b a) -> m s etc st t box =   with box $ \(Box c e) ->-    (e |> toStream |> transduce t |> fromStream) c |> flip execStateT st+    (e & toStream & transduce t & fromStream) c & flip execStateT st  etcM :: (MonadConc m, MonadBase m m) => s -> Transducer s a b -> Cont m (Box m b a) -> m s etcM st t box =   with box $ \(Box c e) ->-    (liftE' e |> toStreamM |> transduce t |> fromStreamM) (liftC' c) |> flip execStateT st+    (liftE' e & toStreamM & transduce t & fromStreamM) (liftC' c) & flip execStateT st   where     liftC' c = Committer $ liftBase . commit c     liftE' = Emitter . liftBase . emit
test/ctest.hs view
@@ -94,7 +94,7 @@ exe1c2IO n = e1c2IO (toEmit (S.take n $ S.each [0..]))  -- | test when the deterministic takes too long (which is almost always)-t :: (MonadConc n, MonadIO n, Eq b, Show b, MonadDejaFu n) =>+t :: (MonadIO n, Eq b, Show b, MonadDejaFu n) =>      String -> ConcT n b -> n Bool t l c = dejafuWay (randomly (mkStdGen 42) 1000) defaultMemType l alwaysSame c @@ -319,7 +319,7 @@   pure True  -- boxCount' :: (MonadState StateExs m, MonadConc m) => Int -> Box m Int Int-boxCount' n = Box (zoom #result resultCommitter) (zoom #count (countEmitter n))+-- boxCount' n = Box (zoom #result resultCommitter) (zoom #count (countEmitter n))  exs :: (MonadConc m) => Int -> m [Int] exs n = do