potoki-core 1.5.1 → 1.5.2
raw patch · 3 files changed
+19/−14 lines, 3 filesdep ~tasty-hunitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: tasty-hunit
API changes (from Hackage documentation)
+ Potoki.Core.Fetch: ioMaybe :: IO (Maybe a) -> Fetch a
Files
library/Potoki/Core/Fetch.hs view
@@ -99,39 +99,44 @@ {-# INLINABLE firstCachingSecond #-} firstCachingSecond :: IORef b -> Fetch (a, b) -> Fetch a-firstCachingSecond cacheRef (Fetch bothFetchIO) =+firstCachingSecond stateRef (Fetch bothFetchIO) = Fetch $ \ nil just -> join $ bothFetchIO (return nil) (\ (!first, !second) -> do- writeIORef cacheRef second+ writeIORef stateRef second return (just first)) {-# INLINABLE bothFetchingFirst #-} bothFetchingFirst :: IORef b -> Fetch a -> Fetch (a, b)-bothFetchingFirst cacheRef (Fetch firstFetchIO) =+bothFetchingFirst stateRef (Fetch firstFetchIO) = Fetch $ \ nil just -> join $ firstFetchIO (return nil) (\ !firstFetched -> do- secondCached <- readIORef cacheRef+ secondCached <- readIORef stateRef return (just (firstFetched, secondCached))) {-# INLINABLE rightCachingLeft #-} rightCachingLeft :: IORef (Maybe left) -> Fetch (Either left right) -> Fetch right-rightCachingLeft cacheRef (Fetch eitherFetchIO) =+rightCachingLeft stateRef (Fetch eitherFetchIO) = Fetch $ \ nil just -> join $ eitherFetchIO (return nil) $ \ case Right !rightInput -> return (just rightInput)- Left !leftInput -> writeIORef cacheRef (Just leftInput) $> nil+ Left !leftInput -> writeIORef stateRef (Just leftInput) $> nil {-# INLINABLE eitherFetchingRight #-} eitherFetchingRight :: IORef (Maybe left) -> Fetch right -> Fetch (Either left right)-eitherFetchingRight cacheRef (Fetch rightFetchIO) =+eitherFetchingRight stateRef (Fetch rightFetchIO) = Fetch $ \ nil just -> join $ rightFetchIO (return nil) $ \ right ->- atomicModifyIORef' cacheRef $ \ case+ atomicModifyIORef' stateRef $ \ case Nothing -> (Nothing, just (Right right)) Just left -> (Nothing, just (Left left))++{-# INLINE ioMaybe #-}+ioMaybe :: IO (Maybe a) -> Fetch a+ioMaybe io =+ Fetch $ \nil just -> maybe nil just <$> io
library/Potoki/Core/Transform.hs view
@@ -54,9 +54,9 @@ instance Strong Transform where first' (Transform firstTransformIO) = Transform $ \ bothFetch -> do- cacheRef <- newIORef undefined- firstFetch <- firstTransformIO (A.firstCachingSecond cacheRef bothFetch)- return $ A.bothFetchingFirst cacheRef firstFetch+ stateRef <- newIORef undefined+ firstFetch <- firstTransformIO (A.firstCachingSecond stateRef bothFetch)+ return $ A.bothFetchingFirst stateRef firstFetch instance Arrow Transform where arr fn =
potoki-core.cabal view
@@ -1,7 +1,7 @@ name: potoki-core version:- 1.5.1+ 1.5.2 synopsis: Low-level components of "potoki" description:@@ -17,7 +17,7 @@ author: Nikita Volkov <nikita.y.volkov@mail.ru> maintainer:- Metrix.AI Tech Team <tech@metrix.ai>+ Metrix.AI Ninjas <ninjas@metrix.ai> copyright: (c) 2017, Metrix.AI license:@@ -75,7 +75,7 @@ -- testing: tasty >=0.12 && <0.13, tasty-quickcheck >=0.9 && <0.10,- tasty-hunit >=0.9 && <0.10,+ tasty-hunit >=0.9 && <0.11, quickcheck-instances >=0.3.11 && <0.4, QuickCheck >=2.8.1 && <3, --