on master help sign in
Fix some warnings
b33dd6fMichael Snoyman
Text/Libyaml.hs+2−9
@@ -40,7 +40,6 @@ import Foreign.Marshal.Alloc
40import Data.Data
40import Data.Data
41
41
42import Control.Monad.IO.Class
42import Control.Monad.IO.Class
43−import Control.Monad.Trans.Class (lift)
44
43
45import Control.Exception (throwIO, Exception, finally)
44import Control.Exception (throwIO, Exception, finally)
46import Control.Applicative
45import Control.Applicative
@@ -152,12 +151,6 @@ foreign import ccall unsafe "fclose"
152foreign import ccall unsafe "fclose_helper"
151foreign import ccall unsafe "fclose_helper"
153 c_fclose_helper :: File -> IO ()
152 c_fclose_helper :: File -> IO ()
154
153
155−withForeignPtr' :: MonadIO m => ForeignPtr a -> (Ptr a -> m b) -> m b
156−withForeignPtr' fp f = do
157− r <- f $ unsafeForeignPtrToPtr fp
158− liftIO $ touchForeignPtr fp
159− return r
160−
161foreign import ccall unsafe "yaml_parser_parse"
154foreign import ccall unsafe "yaml_parser_parse"
162 c_yaml_parser_parse :: Parser -> EventRaw -> IO CInt
155 c_yaml_parser_parse :: Parser -> EventRaw -> IO CInt
163
156
@@ -560,7 +553,7 @@ encodeFile :: ResourceIO m
560 => FilePath
553 => FilePath
561 -> C.Sink Event m ()
554 -> C.Sink Event m ()
562encodeFile filePath = C.Sink $ do
555encodeFile filePath = C.Sink $ do
563− (releaseKey, file) <- flip withIO c_fclose $ do
556+ (_releaseKey, file) <- flip withIO c_fclose $ do
564 file <- liftIO $ withCString filePath $
557 file <- liftIO $ withCString filePath $
565 \filePath' -> withCString "w" $
558 \filePath' -> withCString "w" $
566 \w' -> c_fopen filePath' w'
559 \w' -> c_fopen filePath' w'
@@ -590,7 +583,7 @@ runEmitter allocI closeI =
590 c_yaml_emitter_delete emitter
583 c_yaml_emitter_delete emitter
591 free emitter
584 free emitter
592 push (emitter, _) e = do
585 push (emitter, _) e = do
593− liftIO $ toEventRaw e $ c_yaml_emitter_emit emitter
586+ _ <- liftIO $ toEventRaw e $ c_yaml_emitter_emit emitter
594 return C.Processing
587 return C.Processing
595 close (_, a) = liftIO $ closeI a
588 close (_, a) = liftIO $ closeI a
596
589