    module Data.GI.GIR.Function
        ( Function(..)
        , parseFunction
        ) where

    import Data.Text (Text)

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

    data Function = Function {
      -- | The symbol in the dynlib that this function refers to.
          Function -> ParseError
    fnSymbol   :: Text
        , Function -> Maybe ParseError
    fnMovedTo  :: Maybe Text
        , Function -> Callable
    fnCallable :: Callable
        } deriving Int -> Function -> ShowS
    [Function] -> ShowS
    Function -> String
    (Int -> Function -> ShowS)
    -> (Function -> String) -> ([Function] -> ShowS) -> Show Function
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Function -> ShowS
    showsPrec :: Int -> Function -> ShowS
    $cshow :: Function -> String
    show :: Function -> String
    $cshowList :: [Function] -> ShowS
    showList :: [Function] -> ShowS
    Show

    parseFunction :: Parser (Name, Function)
    parseFunction :: Parser (Name, Function)
    parseFunction = do
      name <- Parser Name
    parseName
      shadows <- queryAttr "shadows"
      let exposedName = case Maybe ParseError
    shadows of
                          Just ParseError
    n -> Name
    name {name = n}
                          Maybe ParseError
    Nothing -> Name
    name
      callable <- parseCallable
      symbol <- getAttrWithNamespace CGIRNS "identifier"
      movedTo <- queryAttr "moved-to"
      return $ (exposedName,
                Function {
                  fnSymbol = symbol
                , fnCallable = callable
                , fnMovedTo = movedTo
                })