@@ -23,13 +23,14 @@ import Foreign.Ptr
23import Foreign.ForeignPtr
23import Foreign.ForeignPtr
24import Foreign.Marshal.Alloc
24import Foreign.Marshal.Alloc
26−import Control.Monad.Failure
26+import Control.Failure
27import Data.Typeable (Typeable)
27import Data.Typeable (Typeable)
28import Control.Exception (Exception)
28import Control.Exception (Exception)
30−import Data.Convertible
30+import Data.Convertible.Text
31import Data.Text.Lazy (Text)
31import Data.Text.Lazy (Text)
32import Data.Object.Text ()
32import Data.Object.Text ()
33+import Control.Applicative
34data ParserStruct
35data ParserStruct
35type Parser = Ptr ParserStruct
36type Parser = Ptr ParserStruct
@@ -181,11 +182,16 @@ getEvent er = do
181 YamlMappingEndEvent -> return EventMappingEnd
182 YamlMappingEndEvent -> return EventMappingEnd
183data YAttempt v = YSuccess v | YFailure YamlException
184data YAttempt v = YSuccess v | YFailure YamlException
185+instance Functor YAttempt where
187+instance Applicative YAttempt where
184instance Monad YAttempt where
190instance Monad YAttempt where
185 return = YSuccess
191 return = YSuccess
186 YSuccess v >>= f = f v
192 YSuccess v >>= f = f v
187 YFailure e >>= _ = YFailure e
193 YFailure e >>= _ = YFailure e
188−instance MonadFailure YamlException YAttempt where
194+instance Failure YamlException YAttempt where
189 failure = YFailure
195 failure = YFailure
191parserParse :: MonadFailure YamlException m
197parserParse :: MonadFailure YamlException m
@@ -291,10 +297,10 @@ foreign import ccall unsafe "yaml_scalar_event_initialize"
291 -> Ptr CUChar -- anchor
297 -> Ptr CUChar -- anchor
292 -> Ptr CUChar -- tag
298 -> Ptr CUChar -- tag
293 -> Ptr CUChar -- value
299 -> Ptr CUChar -- value
294− -> CInt
300+ -> CInt -- length
295− -> CInt
301+ -> CInt -- plain_implicit
296− -> CInt
302+ -> CInt -- quoted_implicit
297− -> CInt
303+ -> CInt -- style
298 -> IO CInt
304 -> IO CInt
300foreign import ccall unsafe "simple_document_start"
306foreign import ccall unsafe "simple_document_start"
@@ -350,13 +356,13 @@ toEventRaw e f = withEventRaw $ \er -> do
350 else value'
356 else value'
351 c_yaml_scalar_event_initialize
357 c_yaml_scalar_event_initialize
353− nullPtr
359+ nullPtr -- anchor
354− nullPtr
360+ nullPtr -- tag
355− value''
361+ value'' -- value
356− len'
362+ len' -- length
357− 0
363+ 0 -- plain_implicit
358− 1
364+ 1 -- quoted_implicit
359− 0 -- YAML_ANY_SCALAR_STYLE
365+ 0 -- YAML_ANY_SCALAR_STYLE
360 EventSequenceStart ->
366 EventSequenceStart ->
361 c_yaml_sequence_start_event_initialize
367 c_yaml_sequence_start_event_initialize