@@ -57,6 +57,7 @@ module Streamly.Internal.Prelude
58 , unfoldrM
58 , unfoldrM
61 , iterateM
62 , iterateM
62 , fromIndices
63 , fromIndices
@@ -536,6 +537,7 @@ import Data.Kind (Type)
537import Data.Heap (Entry(..))
538import Data.Heap (Entry(..))
538import Data.Maybe (isJust, fromJust, isNothing)
539import Data.Maybe (isJust, fromJust, isNothing)
540+import Data.Void (Void)
539import Foreign.Storable (Storable)
541import Foreign.Storable (Storable)
540import Prelude
542import Prelude
541 hiding (filter, drop, dropWhile, take, takeWhile, zipWith, foldr,
543 hiding (filter, drop, dropWhile, take, takeWhile, zipWith, foldr,
@@ -706,6 +708,13 @@ unfoldrMZipSerial = Serial.unfoldrM
706unfold :: (IsStream t, Monad m) => Unfold m a b -> a -> t m b
708unfold :: (IsStream t, Monad m) => Unfold m a b -> a -> t m b
707unfold unf x = fromStreamD $ D.unfold unf x
709unfold unf x = fromStreamD $ D.unfold unf x
711+-- | Convert an 'Unfold' with a closed input end into a stream.
714+{-# INLINE unfold0 #-}
715+unfold0 :: (IsStream t, Monad m) => Unfold m Void b -> t m b
716+unfold0 unf = unfold unf (error "unfold0: unexpected void evaluation")
709------------------------------------------------------------------------------
718------------------------------------------------------------------------------
710-- Specialized Generation
719-- Specialized Generation
711------------------------------------------------------------------------------
720------------------------------------------------------------------------------