deferred-folds 0.6.7 → 0.6.8
raw patch · 2 files changed
+8/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ DeferredFolds.UnfoldM: hoist :: (forall a. m a -> n a) -> (forall a. n a -> m a) -> UnfoldM m a -> UnfoldM n a
Files
deferred-folds.cabal view
@@ -1,7 +1,7 @@ name: deferred-folds version:- 0.6.7+ 0.6.8 category: Folding synopsis:
library/DeferredFolds/UnfoldM.hs view
@@ -68,6 +68,7 @@ instance Show a => Show (UnfoldM Identity a) where show = show . toList +{-| Check whether it's empty -} {-# INLINE null #-} null :: Monad m => UnfoldM m input -> m Bool null (UnfoldM run) = run (\ _ _ -> return False) True@@ -142,3 +143,9 @@ tVarValue var = UnfoldM $ \ step state -> do a <- readTVar var step state a++{-| Change the base monad using invariant natural transformations -}+{-# INLINE hoist #-}+hoist :: (forall a. m a -> n a) -> (forall a. n a -> m a) -> UnfoldM m a -> UnfoldM n a+hoist trans1 trans2 (UnfoldM unfold) = UnfoldM $ \ step init -> + trans1 (unfold (\ a b -> trans2 (step a b)) init)