@@ -23,13 +23,14 @@ import Foreign.Ptr
2323import Foreign.ForeignPtr
2424import Foreign.Marshal.Alloc
2525
26−import Control.Monad.Failure
26+import Control.Failure
2727import Data.Typeable (Typeable)
2828import Control.Exception (Exception)
2929
30−import Data.Convertible
30+import Data.Convertible.Text
3131import Data.Text.Lazy (Text)
3232import Data.Object.Text ()
33+import Control.Applicative
3334
3435data ParserStruct
3536type Parser = Ptr ParserStruct
@@ -181,11 +182,16 @@ getEvent er = do
181182 YamlMappingEndEvent -> return EventMappingEnd
182183
183184data YAttempt v = YSuccess v | YFailure YamlException
185+instance Functor YAttempt where
186+ fmap = liftM
187+instance Applicative YAttempt where
188+ pure = return
189+ (<*>) = ap
184190instance Monad YAttempt where
185191 return = YSuccess
186192 YSuccess v >>= f = f v
187193 YFailure e >>= _ = YFailure e
188−instance MonadFailure YamlException YAttempt where
194+instance Failure YamlException YAttempt where
189195 failure = YFailure
190196
191197parserParse :: MonadFailure YamlException m
@@ -291,10 +297,10 @@ foreign import ccall unsafe "yaml_scalar_event_initialize"
291297 -> Ptr CUChar -- anchor
292298 -> Ptr CUChar -- tag
293299 -> Ptr CUChar -- value
294− -> CInt
295− -> CInt
296− -> CInt
297− -> CInt
300+ -> CInt -- length
301+ -> CInt -- plain_implicit
302+ -> CInt -- quoted_implicit
303+ -> CInt -- style
298304 -> IO CInt
299305
300306foreign import ccall unsafe "simple_document_start"
@@ -350,13 +356,13 @@ toEventRaw e f = withEventRaw $ \er -> do
350356 else value'
351357 c_yaml_scalar_event_initialize
352358 er
353− nullPtr
354− nullPtr
355− value''
356− len'
357− 0
358− 1
359− 0 -- YAML_ANY_SCALAR_STYLE
359+ nullPtr -- anchor
360+ nullPtr -- tag
361+ value'' -- value
362+ len' -- length
363+ 0 -- plain_implicit
364+ 1 -- quoted_implicit
365+ 0 -- YAML_ANY_SCALAR_STYLE
360366 EventSequenceStart ->
361367 c_yaml_sequence_start_event_initialize
362368 er