@@ -122,6 +122,7 @@ module Streamly.Streams.StreamD
@@ -896,6 +897,10 @@ null m = foldrM (\_ _ -> return False) (return True) m
896head :: Monad m => Stream m a -> m (Maybe a)
897head :: Monad m => Stream m a -> m (Maybe a)
897head m = foldrM (\x _ -> return (Just x)) (return Nothing) m
898head m = foldrM (\x _ -> return (Just x)) (return Nothing) m
900+{-# INLINE_NORMAL headElse #-}
901+headElse :: Monad m => a -> Stream m a -> m a
902+headElse a m = foldrM (\x _ -> return x) (return a) m
899-- Does not fuse, has the same performance as the StreamK version.
904-- Does not fuse, has the same performance as the StreamK version.
900{-# INLINE_NORMAL tail #-}
905{-# INLINE_NORMAL tail #-}
901tail :: Monad m => Stream m a -> m (Maybe (Stream m a))
906tail :: Monad m => Stream m a -> m (Maybe (Stream m a))