on master help sign in
More polymorphic fromLBS
dc830bdMichael Snoyman
Network/Wai/Enumerator.hs+3−2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE Rank2Types #-}
1-- | A collection of utility functions for dealing with 'Enumerator's.
2-- | A collection of utility functions for dealing with 'Enumerator's.
2module Network.Wai.Enumerator
3module Network.Wai.Enumerator
3 ( -- * Utilities
4 ( -- * Utilities
@@ -40,7 +41,7 @@ toLBS e = L.fromChunks `fmap` helper where
40 xs <- helper
41 xs <- helper
41 return $ x' : xs
42 return $ x' : xs
42
43
43−fromLBS :: L.ByteString -> Enumerator a
44+fromLBS :: L.ByteString -> (forall a. Enumerator a)
44fromLBS lbs iter a0 = helper a0 $ L.toChunks lbs where
45fromLBS lbs iter a0 = helper a0 $ L.toChunks lbs where
45 helper a [] = return $ Right a
46 helper a [] = return $ Right a
46 helper a (x:xs) = do
47 helper a (x:xs) = do
@@ -49,7 +50,7 @@ fromLBS lbs iter a0 = helper a0 $ L.toChunks lbs where
49 Left a' -> return $ Left a'
50 Left a' -> return $ Left a'
50 Right a' -> helper a' xs
51 Right a' -> helper a' xs
51
52
52−fromLBS' :: IO L.ByteString -> Enumerator a
53+fromLBS' :: IO L.ByteString -> (forall a. Enumerator a)
53fromLBS' lbs' iter a0 = lbs' >>= \lbs -> fromLBS lbs iter a0
54fromLBS' lbs' iter a0 = lbs' >>= \lbs -> fromLBS lbs iter a0
54
55
55-- | A source is a more standard way of accessing data from an 'Enumerator'.
56-- | A source is a more standard way of accessing data from an 'Enumerator'.