on master help sign in
Update comments based on feedback.
commita4079b23c4dd9ffb620ed54fb27d7eb043d1a3a7 authorAlex Franchuk <afranchuk@lgsinnovations.com> dateTue 9 Oct 2018, 09:03 (8 years ago) parent91c6658
1 file changed+15−5
src/Text/Libyaml.hs+15−5
src/Text/Libyaml.hs+15−5
@@ -79,7 +79,7 @@ data Event =
7979
8080-- | Event with start and end marks.
8181--
82−-- @since [INSERTVERSION]
82+-- @since 0.10.4.0
8383data MarkedEvent = MarkedEvent
8484 { yamlEvent :: Event
8585 , yamlStartMark :: YamlMark
@@ -552,11 +552,16 @@ newtype ToEventRawException = ToEventRawException CInt
552552 deriving (Show, Typeable)
553553instance Exception ToEventRawException
554554
555+-- | Create a conduit that yields events from a bytestring.
555556decode :: MonadResource m => B.ByteString -> ConduitM i Event m ()
556557decode = mapOutput yamlEvent . decodeMarked
557558
558−-- |
559−-- @since [INSERTVERSION]
559+-- | Create a conduit that yields marked events from a bytestring.
560+--
561+-- This conduit will yield identical events to that of "decode", but also
562+-- includes start and end marks for each event.
563+--
564+-- @since 0.10.4.0
560565decodeMarked :: MonadResource m => B.ByteString -> ConduitM i MarkedEvent m ()
561566decodeMarked bs | B8.null bs = return ()
562567decodeMarked bs =
@@ -599,11 +604,16 @@ openFile file rawOpenFlags openMode = do
599604 then withCString openMode $ \openMode' -> c_fdopen fd openMode'
600605 else return nullPtr
601606
607+-- | Creata a conduit that yields events from a file.
602608decodeFile :: MonadResource m => FilePath -> ConduitM i Event m ()
603609decodeFile = mapOutput yamlEvent . decodeFileMarked
604610
605−-- |
606−-- @since [INSERTVERSION]
611+-- | Create a conduit that yields marked events from a file.
612+--
613+-- This conduit will yield identical events to that of "decodeFile", but also
614+-- includes start and end marks for each event.
615+--
616+-- @since 0.10.4.0
607617decodeFileMarked :: MonadResource m => FilePath -> ConduitM i MarkedEvent m ()
608618decodeFileMarked file =
609619 bracketP alloc cleanup (runParser . fst)