packages feed

yaml 0.5.1.2 → 0.5.2

raw patch · 2 files changed

+27/−15 lines, 2 filesdep ~conduit

Dependency ranges changed: conduit

Files

Text/Libyaml.hs view
@@ -505,13 +505,13 @@         c_yaml_parser_delete ptr         free ptr -runParser :: ResourceIO m => Parser -> m (C.SourceResult Event)+runParser :: ResourceIO m => Parser -> m (C.SourceIOResult Event) runParser parser = liftIO $ do     e <- parserParseOne' parser     case e of         Left err -> throwIO $ YamlException err-        Right Nothing -> return $ C.Closed-        Right (Just ev) -> return $ C.Open ev+        Right Nothing -> return $ C.IOClosed+        Right (Just ev) -> return $ C.IOOpen ev  parserParseOne' :: Parser                 -> IO (Either String (Maybe Event))@@ -552,16 +552,24 @@ encodeFile :: ResourceIO m            => FilePath            -> C.Sink Event m ()-encodeFile filePath = C.Sink $ do-    (_releaseKey, file) <- flip withIO c_fclose $ do-        file <- liftIO $ withCString filePath $-                    \filePath' -> withCString "w" $-                    \w' -> c_fopen filePath' w'-        if (file == nullPtr)-            then throwIO $ YamlException $ "could not open file for write: " ++ filePath-            else return file-    C.prepareSink $ runEmitter (alloc file) (return) -- FIXME close file early+encodeFile filePath = C.SinkData+    { C.sinkPush = \input -> do+        sink <- msink+        C.sinkPush sink input+    , C.sinkClose = do+        sink <- msink+        C.sinkClose sink+    }   where+    msink = do+        (_releaseKey, file) <- flip withIO c_fclose $ do+            file <- liftIO $ withCString filePath $+                        \filePath' -> withCString "w" $+                        \w' -> c_fopen filePath' w'+            if (file == nullPtr)+                then throwIO $ YamlException $ "could not open file for write: " ++ filePath+                else return file+        return $ runEmitter (alloc file) (return) -- FIXME close file early     alloc file emitter = do         c_yaml_emitter_set_output_file emitter file         return ()@@ -584,7 +592,7 @@         free emitter     push (emitter, _) e = do         _ <- liftIO $ toEventRaw e $ c_yaml_emitter_emit emitter-        return C.Processing+        return C.IOProcessing     close (_, a) = liftIO $ closeI a  data YamlException = YamlException String
yaml.cabal view
@@ -1,5 +1,5 @@ name:            yaml-version:         0.5.1.2+version:         0.5.2 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov @@ -30,7 +30,7 @@     build-depends:   base >= 4 && < 5                    , transformers >= 0.1 && < 0.3                    , bytestring >= 0.9.1.4 && < 0.10-                   , conduit+                   , conduit >= 0.2 && < 0.3                    , aeson >= 0.5                    , containers                    , unordered-containers@@ -71,3 +71,7 @@                    , text                    , unordered-containers     ghc-options:     -Wall++source-repository head+  type:     git+  location: https://github.com/snoyberg/yaml