Permalink
Browse files

added 'putLiftIO' function to lift 'IO' actions into the 'Put' monad

  • Loading branch information...
meiersi committed Dec 28, 2010
1 parent 9d425ad commit 7e3824ee54615cc3fb88bfc99994a6a3e95eac18
Showing with 7 additions and 0 deletions.
  1. +1 −0 Blaze/ByteString/Builder/Internal.hs
  2. +6 −0 Blaze/ByteString/Builder/Internal/Types.hs
@@ -30,6 +30,7 @@ module Blaze.ByteString.Builder.Internal (
, Put
, putBuilder
, putBuildStepCont
+ , putLiftIO
-- * Writes
, module Blaze.ByteString.Builder.Internal.Write
@@ -134,4 +134,10 @@ putBuilder (Builder build) = Put $ \k -> build (k ())
fromPut :: Put a -> Builder
fromPut (Put put) = Builder $ \k -> put (\_ -> k)
+-- Lifting IO actions
+---------------------
+-- | Lift the given IO action.
+{-# INLINE putLiftIO #-}
+putLiftIO :: IO a -> Put a
+putLiftIO io = putBuildStepCont $ \k br -> io >>= (`k` br)

0 comments on commit 7e3824e

Please sign in to comment.