diff --git a/Data/Yaml.hs b/Data/Yaml.hs
--- a/Data/Yaml.hs
+++ b/Data/Yaml.hs
@@ -127,7 +127,7 @@
 instance MonadIO m => MonadIO (PErrorT m) where
     liftIO = lift . liftIO
 
-type Parse = StateT (Map.Map String Value) IO
+type Parse = StateT (Map.Map String Value) (C.ResourceT IO)
 
 requireEvent :: Event -> C.Sink Event Parse ()
 requireEvent e = do
@@ -242,7 +242,7 @@
              => C.Source Parse Y.Event
              -> IO (Either ParseException (Maybe a))
 decodeHelper src = do
-    x <- try $ flip evalStateT Map.empty $ C.runResourceT $ src C.$$ parse
+    x <- try $ C.runResourceT $ flip evalStateT Map.empty $ src C.$$ parse
     case x of
         Left e
             | Just pe <- fromException e -> return $ Left pe
diff --git a/Text/Libyaml.hs b/Text/Libyaml.hs
--- a/Text/Libyaml.hs
+++ b/Text/Libyaml.hs
@@ -45,6 +45,7 @@
 import Control.Applicative
 import Control.Monad.Trans.Resource
 import qualified Data.Conduit as C
+import Control.Exception (mask_)
 
 data Event =
       EventStreamStart
@@ -451,7 +452,7 @@
     deriving (Show, Typeable)
 instance Exception ToEventRawException
 
-decode :: ResourceIO m => B.ByteString -> C.Source m Event
+decode :: C.MonadResource m => B.ByteString -> C.Source m Event
 decode bs =
     C.sourceIO alloc cleanup (runParser . fst)
   where
@@ -474,7 +475,7 @@
         c_yaml_parser_delete ptr
         free ptr
 
-decodeFile :: ResourceIO m => FilePath -> C.Source m Event
+decodeFile :: C.MonadResource m => FilePath -> C.Source m Event
 decodeFile file =
     C.sourceIO alloc cleanup (runParser . fst)
   where
@@ -505,7 +506,7 @@
         c_yaml_parser_delete ptr
         free ptr
 
-runParser :: ResourceIO m => Parser -> m (C.SourceIOResult Event)
+runParser :: C.MonadResource m => Parser -> m (C.SourceIOResult Event)
 runParser parser = liftIO $ do
     e <- parserParseOne' parser
     case e of
@@ -534,7 +535,7 @@
             ]
         else Right <$> getEvent er
 
-encode :: ResourceIO m => C.Sink Event m ByteString
+encode :: C.MonadResource m => C.Sink Event m ByteString
 encode =
     runEmitter alloc close
   where
@@ -549,20 +550,14 @@
         fptr <- newForeignPtr_ $ castPtr ptr'
         return $ B.fromForeignPtr fptr 0 $ fromIntegral len
 
-encodeFile :: ResourceIO m
+encodeFile :: C.MonadResource m
            => FilePath
            -> C.Sink Event m ()
-encodeFile filePath = C.SinkData
-    { C.sinkPush = \input -> do
-        sink <- msink
-        C.sinkPush sink input
-    , C.sinkClose = do
-        sink <- msink
-        C.sinkClose sink
-    }
+encodeFile filePath =
+    C.SinkM msink
   where
     msink = do
-        (_releaseKey, file) <- flip withIO c_fclose $ do
+        (_releaseKey, file) <- flip allocate c_fclose $ do
             file <- liftIO $ withCString filePath $
                         \filePath' -> withCString "w" $
                         \w' -> c_fopen filePath' w'
@@ -574,7 +569,7 @@
         c_yaml_emitter_set_output_file emitter file
         return ()
 
-runEmitter :: ResourceIO m
+runEmitter :: C.MonadResource m
            => (Emitter -> IO a) -- ^ alloc
            -> (a -> IO b) -- ^ close
            -> C.Sink Event m b
diff --git a/test/main.hs b/test/main.hs
--- a/test/main.hs
+++ b/test/main.hs
@@ -54,7 +54,7 @@
         it "test mapping merge" caseSimpleMappingMerge
         it "test sequence of mappings merging" caseMergeSequence
 
-counter :: (Y.Event -> Bool) -> C.Sink Y.Event IO Int
+counter :: Monad m => (Y.Event -> Bool) -> C.Sink Y.Event m Int
 counter pred' =
     CL.fold (\cnt e -> (if pred' e then 1 else 0) + cnt) 0
 
diff --git a/yaml.cabal b/yaml.cabal
--- a/yaml.cabal
+++ b/yaml.cabal
@@ -1,5 +1,5 @@
 name:            yaml
-version:         0.5.2
+version:         0.6.0
 license:         BSD3
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov 
@@ -30,7 +30,8 @@
     build-depends:   base >= 4 && < 5
                    , transformers >= 0.1 && < 0.3
                    , bytestring >= 0.9.1.4 && < 0.10
-                   , conduit >= 0.2 && < 0.3
+                   , conduit >= 0.3 && < 0.4
+                   , resourcet >= 0.3 && < 0.4
                    , aeson >= 0.5
                    , containers
                    , unordered-containers
