    -- | Parsing of callbacks.
    module Data.GI.GIR.Callback
        ( Callback(..)
        , parseCallback
        ) where

    import Data.Text (Text)

    import Data.GI.GIR.Callable (Callable, parseCallable)
    import Data.GI.GIR.Parser
    import Data.GI.GIR.Type (queryCType)

    data Callback = Callback { Callback -> Callable
    cbCallable :: Callable
                             , Callback -> Maybe ParseError
    cbCType    :: Maybe Text
                             , Callback -> Documentation
    cbDocumentation :: Documentation
                             }
        deriving Int -> Callback -> ShowS
    [Callback] -> ShowS
    Callback -> String
    (Int -> Callback -> ShowS)
    -> (Callback -> String) -> ([Callback] -> ShowS) -> Show Callback
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Callback -> ShowS
    showsPrec :: Int -> Callback -> ShowS
    $cshow :: Callback -> String
    show :: Callback -> String
    $cshowList :: [Callback] -> ShowS
    showList :: [Callback] -> ShowS
    Show

    parseCallback :: Parser (Name, Callback)
    parseCallback :: Parser (Name, Callback)
    parseCallback = do
      name <- Parser Name
    parseName
      callable <- parseCallable
      ctype <- queryCType
      doc <- parseDocumentation
      return (name, Callback { cbCallable = callable
                             , cbCType = ctype
                             , cbDocumentation = doc })