@@ -479,12 +479,7 @@ newtype ToEventRawException = ToEventRawException CInt
479479 deriving (Show, Typeable)
480480instance Exception ToEventRawException
481481
482−decode :: MonadResource m => B.ByteString
483−#if MIN_VERSION_conduit(1, 0, 0)
484− -> Producer m Event
485−#else
486− -> GSource m Event
487−#endif
482+decode :: MonadResource m => B.ByteString -> Producer m Event
488483decode bs | B8.null bs = return ()
489484decode bs =
490485 bracketP alloc cleanup (runParser . fst)
@@ -526,12 +521,7 @@ openFile file rawOpenFlags openMode = do
526521 then withCString openMode $ \openMode' -> c_fdopen fd openMode'
527522 else return nullPtr
528523
529−decodeFile :: MonadResource m => FilePath
530−#if MIN_VERSION_conduit(1, 0, 0)
531− -> Producer m Event
532−#else
533− -> GSource m Event
534−#endif
524+decodeFile :: MonadResource m => FilePath -> Producer m Event
535525decodeFile file =
536526 bracketP alloc cleanup (runParser . fst)
537527 where
@@ -559,12 +549,7 @@ decodeFile file =
559549 c_yaml_parser_delete ptr
560550 free ptr
561551
562−runParser :: MonadResource m => Parser
563−#if MIN_VERSION_conduit(1, 0, 0)
564− -> Producer m Event
565−#else
566− -> GSource m Event
567−#endif
552+runParser :: MonadResource m => Parser -> Producer m Event
568553runParser parser = do
569554 e <- liftIO $ parserParseOne' parser
570555 case e of
@@ -588,12 +573,7 @@ parserParseOne' parser = allocaBytes eventSize $ \er -> do
588573 return $ Left $ YamlParseException problem context problemMark
589574 else Right <$> getEvent er
590575
591−encode :: MonadResource m
592−#if MIN_VERSION_conduit(1, 0, 0)
593− => Consumer Event m ByteString
594−#else
595− => GSink Event m ByteString
596−#endif
576+encode :: MonadResource m => Consumer Event m ByteString
597577encode =
598578 runEmitter alloc close
599579 where
@@ -610,11 +590,7 @@ encode =
610590
611591encodeFile :: MonadResource m
612592 => FilePath
613−#if MIN_VERSION_conduit(1, 0, 0)
614593 -> Consumer Event m ()
615−#else
616− -> GInfSink Event m
617−#endif
618594encodeFile filePath =
619595 bracketP getFile c_fclose $ \file -> runEmitter (alloc file) (\u _ -> return u)
620596 where
@@ -628,13 +604,8 @@ encodeFile filePath =
628604
629605runEmitter :: MonadResource m
630606 => (Emitter -> IO a) -- ^ alloc
631−#if MIN_VERSION_conduit(1, 0, 0)
632607 -> (() -> a -> IO b) -- ^ close
633608 -> Consumer Event m b
634−#else
635− -> (u -> a -> IO b) -- ^ close
636− -> Pipe l Event o u m b
637−#endif
638609runEmitter allocI closeI =
639610 bracketP alloc cleanup go
640611 where
@@ -654,11 +625,7 @@ runEmitter allocI closeI =
654625 go (emitter, a) =
655626 loop
656627 where
657−#if MIN_VERSION_conduit(1, 0, 0)
658628 loop = await >>= maybe (close ()) push
659−#else
660− loop = awaitE >>= either close push
661−#endif
662629
663630 push e = do
664631 _ <- liftIO $ toEventRaw e $ c_yaml_emitter_emit emitter