godot-haskell-0.1.0.0: Haskell bindings for the Godot game engine API

Safe HaskellNone
LanguageHaskell2010

Types

Contents

Description

Views of C datatypes. While Language.C.Types.Parse defines datatypes for representing the concrete syntax tree of C types, this module provides friendlier views of C types, by turning them into a data type matching more closely how we read and think about types, both in Haskell and in C. To appreciate the difference, look at the difference between ParameterDeclaration and ParameterDeclaration.

As a bonus, routines are provided for describing types in natural language (English) -- see describeParameterDeclaration and describeType.

Synopsis

Types

newtype Identifier Source #

Constructors

Identifier 

Fields

data Type Source #

Instances
Eq Type Source # 
Instance details

Defined in Types

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 
Instance details

Defined in Types

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Show Type Source # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

FromJSON Type Source # 
Instance details

Defined in Spec

Pretty Type Source # 
Instance details

Defined in Types

Methods

pretty :: Type -> Doc #

prettyList :: [Type] -> Doc #

data Sign Source #

Constructors

Signed 
Unsigned 
Instances
Eq Sign Source # 
Instance details

Defined in Types

Methods

(==) :: Sign -> Sign -> Bool #

(/=) :: Sign -> Sign -> Bool #

Ord Sign Source # 
Instance details

Defined in Types

Methods

compare :: Sign -> Sign -> Ordering #

(<) :: Sign -> Sign -> Bool #

(<=) :: Sign -> Sign -> Bool #

(>) :: Sign -> Sign -> Bool #

(>=) :: Sign -> Sign -> Bool #

max :: Sign -> Sign -> Sign #

min :: Sign -> Sign -> Sign #

Show Sign Source # 
Instance details

Defined in Types

Methods

showsPrec :: Int -> Sign -> ShowS #

show :: Sign -> String #

showList :: [Sign] -> ShowS #

Parsing

type IsTypeName = Identifier -> Bool Source #

Function used to determine whether an Id is a type name.

type CParser m = (Monad m, Functor m, Applicative m, MonadPlus m, Parsing m, CharParsing m, TokenParsing m, LookAheadParsing m, MonadReader IsTypeName m) Source #

All the parsing is done using the type classes provided by the parsers package. You can use the parsing routines with any of the parsers that implement the classes, such as parsec or trifecta.

The MonadReader with IsTypeName is required for parsing C, see http://en.wikipedia.org/wiki/The_lexer_hack.

runCParser Source #

Arguments

:: Stream s Identity Char 
=> IsTypeName

Function determining if an identifier is a type name.

-> String

Source name.

-> s

String to parse.

-> ReaderT IsTypeName (Parsec s ()) a

Parser. Anything with type forall m. CParser m => m a is a valid argument.

-> Either ParseError a 

Runs a CParser using parsec.

quickCParser Source #

Arguments

:: IsTypeName

Function determining if an identifier is a type name.

-> String

String to parse.

-> ReaderT IsTypeName (Parsec String ()) a

Parser. Anything with type forall m. CParser m => m a is a valid argument.

-> a 

Useful for quick testing. Uses "quickCParser" as source name, and throws an error if parsing fails.

quickCParser_ Source #

Arguments

:: String

String to parse.

-> ReaderT IsTypeName (Parsec String ()) a

Parser. Anything with type forall m. CParser m => m a is a valid argument.

-> a 

Like quickCParser, but uses const False as IsTypeName.

Convert to and from high-level views

To english