!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~None &+2346HMType used to generate an   $ with arbitrary allowed type names.C@All the parsing is done using the type classes provided by the parsersh package. You can use the parsing routines with any of the parsers that implement the classes, such as parsec or trifecta.The  with D! is required for parsing C, see  +http://en.wikipedia.org/wiki/The_lexer_hack.D&Function used to determine whether an  is a type name.ERuns a C using parsec.F Useful for quick testing. Uses "quickCParser" as source name, and throws an  if parsing fails.GLike F , but uses   as D.WThis parser parses an IdG and nothing else -- it does not consume trailing spaces and the like.$Precondition: there is at least one  in the list.  !"#$%&'()*+,-./0123456789:;<=>?@ABCDE5Function determining if an identifier is a type name. Source name.String to parse.Parser. Anything with type forall m. CParser m => m a is a valid argument.F5Function determining if an identifier is a type name.String to parse.Parser. Anything with type forall m. CParser m => m a is a valid argument.GString to parse.Parser. Anything with type forall m. CParser m => m a is a valid argument.HIJKLMNOPQRSTUVWX  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXCDEFG@ABKW;?>=<H5:9876I(43210/.-,+*)J$'&%L"#M !NQOPR TS UVM   !"#$'&%( 43210/.-,+*)5:9876;?>=<@ABCDEFGHIJKLMNOPQRSTUVWNone &+-0234E6XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~C"#$%&'56789:@ABCDEFGXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~C@AB5:9876$'&%"#hijklcgfedmyxwvutsrqpon`ba\]^_DCEFG~X[ZYz{|}X[ZY\]^_`bacgfedhijklm yxwvutsrqponz{|}~ None$( [t| CDouble ->  CDouble |] , generates a foreign import wrapper of type (CDouble ->  CDouble) ->  ( (CDouble ->  CDouble)) And invokes it.$( 'foo), if foo :: CDouble ->  CDouble#, splices in an expression of type  ( (CDouble ->  CDouble)).$( [t| CDouble ->  CDouble |]), generates a foreign import dynamic of type  (CDouble ->  CDouble) -> (CDouble ->  CDouble) And invokes it.   None&234:=HKM1Type class used to implement the anti-quoters in . An alias for  .A l stores various information needed to produce the files with the C code derived from the inline C snippets.s can be composed with their   instance, where   is right-biased -- in   x y y will take precedence over x.+Needed to convert C types to Haskell types.+Needed to parse and process antiquotations.KWill determine the extension of the file containing the inline C snippets.This function is used to post-process the functions generated from the C snippets. Currently just used to specify C linkage when generating C++ code.Existential wrapper around .An identifier for a .BSpecifies how to parse and process an antiquotation in the C code.BAll antiquotations (apart from plain variable capture) have syntax  $XXX:YYY Where XXX# is the name of the antiquoter and YYY+ is something parseable by the respective .Parses the body of the antiquotation, returning a hint for the name to assign to the variable that will replace the anti-quotation, the type of said variable, and some arbitrary data which will then be fed to .(Takes the requested purity, the current ), and the type and the body returned by .pReturns the Haskell type for the parameter, and the Haskell expression that will be passed in as the parameter.If the the type returned is ty, the   must have type forall a. (ty -> IO a) -> IO a?. This allows to do resource handling when preparing C values.Care must be taken regarding M. Specifically, the generated IO computation must be idempotent to guarantee its safety when used in pure code. We cannot prevent the IO computation from being inlined, hence potentially duplicated. If non-idempotent marshallers are required (e.g. if an update to some global state is needed), it is best to throw an error when  is . (for example "you cannot use context X with pure'"), which will show up at compile time.TA data type to indicate whether the user requested pure or IO function from HaskellA mapping from mYs to Haskell types. Needed both to parse C types, and to convert them to Haskell types.7Context useful to work with vanilla C. Used by default.3: converts C basic types to their counterparts in Foreign.C.Types.No .Given a , it uses its  to convert arbitrary C types.This  includes a 1 that removes the need for explicitely creating  s, named "fun".%For example, we can capture function f of type CInt -> CInt -> IO CInt in C code using $fun:(int (*f)(int, int)).When used in a puree embedding, the Haskell function will have to be pure too. Continuing the example above we'll have CInt -> CInt -> IO CInt.Does not include the O, since most of the time it's going to be included as part of larger contexts.This  includes two 1s that allow to easily use Haskell vectors in C.Specifically, the vec-len and vec-ptr: will get the length and the pointer underlying mutable (  ) and immutable () storable vectors.Note that if you use c to manipulate immutable vectors you must make sure that the vector is not modified in the C code.To use vec-len, simply write  $vec-len:x, where x is something of type    a or  a , for some a . To use vec-ptr4 you need to specify the type of the pointer, e.g. $vec-len:(int *x) will work if x has type    .$ serves exactly the same purpose as , but only for . vec-ptr becomes bs-ptr, and vec-len becomes bs-len9. You don't need to specify the type of the pointer in bs-ptr, it will always be unsigned char*.(None &3:EHJKM VData type representing a list of C definitions with a typed and named entry function./We use it as a basis to inline and call C code.Safety of the foreign call.Type of the foreign call./Name of the function to call in the code below. The C code.Make sure that + and the respective C file are up to date.Gets the current ;. Also makes sure that the current module is initialised. Sets the  for the current module. This function, if called, must be called before any of the other TH functions in this module. Fails if that's not the case.BSimply appends some string to the module's C file. Use with care./Inlines a piece of code inline. The resulting  & will have the type specified in the .oIn practice, this function outputs the C code to the module's C file, and then inserts a foreign call of type  calling the provided .Example:  c_add :: Int -> Int -> Int c_add = $(inlineCode $ Code TH.Unsafe -- Call safety [t| Int -> Int -> Int |] -- Call type "francescos_add" -- Call name -- C Code "int francescos_add(int x, int y) { int z = x + y; return z; }") Same as  inlineCItems, but with a single expression. c_cos :: Double -> Double c_cos = $(inlineExp TH.Unsafe [t| Double -> Double |] (quickCParser_ "double" parseType) [("x", quickCParser_ "double") parseType] "cos(x)") Same as \, but accepts a string containing a list of C statements instead instead than a full-blown Q. A function containing the provided statement will be automatically generated. c_cos :: Double -> Double c_cos = $(inlineItems TH.Unsafe [t| Double -> Double |] (quickCParser_ "double" parseType) [("x", quickCParser_ "double" parseType)] "return cos(x);") , !"#The ) to use if we initialise the module. If $,  will be used.%&'()Safety of the foreign callType of the foreign callReturn type of the C exprParameters of the C exprThe C expressionSafety of the foreign callType of the foreign callReturn type of the C exprParameters of the C expr The C items>Returns the return type, the captured variables, and the body.* The parser@Function taking that something and building an expression, see  for other args.+,-. !"#%&'()*+,-.NoneC expressions. Variant of 9, for use with expressions known to have no side effects.BEWARE: use this function with caution, only when you know what you are doing. If an expression does in fact have side-effects, then indiscriminate use of K may endanger referential transparency, and in principle even type safety. C code blocks (i.e. statements).None!"=JKMOType class with methods useful to allocate and peek multiple pointers at once: withPtrs_ :: (Storable a, Storable b) => ((Ptr a, Ptr b) -> IO ()) -> IO (a, b) withPtrs_ :: (Storable a, Storable b, Storable c) => ((Ptr a, Ptr b, Ptr c) -> IO ()) -> IO (a, b, c) ... C expressions. Variant of 9, for use with expressions known to have no side effects.BEWARE: use this function with caution, only when you know what you are doing. If an expression does in fact have side-effects, then indiscriminate use of K may endanger referential transparency, and in principle even type safety. C code blocks (i.e. statements).Emits a CPP include directive for C code associated with the current module. To avoid having to escape quotes, the function itself adds them when appropriate, so that %include "foo.h" ==> #include "foo.h" but #include "<foo>" ==> #include <foo> ^Emits an arbitrary C string to the C code associated with the current module. Use with care.Like /%, but also peeks the contents of the  9 and returns them once the provided action has finished. Sets the  for the current module. This function, if called, must be called before any of the other TH functions in this module. Fails if that's not the case.012345I6789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghi012345j    !"#$%%&'()*+,-./0123456789:;<=>?@A(*.;BBCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab !c.ddefg.01/hijklmnopqrstuvwx y z {|}~ c      !"#$%&'()*+,-./01 2 2 3 3 4 4 5 5 6 6   7 7 8 8 9 9 : : ; ; < < = = > > ? ? @ @ A A B B C C D D E E F G H I I J J K K L LMinline-c-0.5.3.1Language.C.Types.ParseLanguage.C.TypesLanguage.C.InlineLanguage.C.Inline.ContextLanguage.C.Inline.InternalLanguage.C.Inline.UnsafeCIdLanguage.C.Inline.FunPtrVIOVector!ParameterDeclarationWithTypeNamespdwtnTypeNamespdwtnParameterDeclarationDirectAbstractDeclaratorAbstractDeclaratorParensArrayOrProtoThereArrayOrProtoHereAbstractDeclaratorabstractDeclaratorPointersabstractDeclaratorDirectParameterDeclarationparameterDeclarationSpecifiersparameterDeclarationDeclaratorPointer ArrayTypeSizedByIdentifierSizedByIntegerUnsized VariablySized ArrayOrProtoProtoArrayDirectDeclaratorDeclaratorParensDeclaratorRoot DeclaratordeclaratorPointersdeclaratorDirectFunctionSpecifierINLINE TypeQualifierVOLATILERESTRICTCONST TypeSpecifierTypeNameEnumStructUNSIGNEDSIGNEDDOUBLEFLOATLONGINTSHORTCHARVOIDStorageClassSpecifierREGISTERAUTOSTATICEXTERNTYPEDEFDeclarationSpecifier Identifier unIdentifierCParser IsTypeName runCParser quickCParser quickCParser_declaration_specifiersstorage_class_specifiertype_specifier identifiertype_qualifierfunction_specifier declaratorarray_or_proto array_typedirect_declaratorpointerparameter_listparameter_declarationabstract_declaratordirect_abstract_declaratoridentifier_no_lex UntangleErrIllegalSpecifiers NoDataTypesMultipleDataTypesparameterDeclarationIdparameterDeclarationTypeSignUnsignedSignedTypePtr SpecifiersstorageClassSpecifierstypeQualifiersfunctionSpecifiersLDoubleDoubleFloatLLongLongIntShortCharVoiduntangleParameterDeclarationtangleParameterDeclarationdescribeParameterDeclaration describeTypeparseParameterDeclarationparseParameterListparseIdentifier parseTypemkFunPtrmkFunPtrFromName peekFunPtrVecCtx VecCtxScalar vecCtxLengthvecCtxUnsafeWithCArrayContext ctxTypesTablectxAntiQuotersctxFileExtension ctxOutput AntiQuotersSomeAntiQuoter AntiQuoterId AntiQuoteraqParser aqMarshallerPurityIOPure TypesTablebaseCtx convertType isTypeNamefunCtxvecCtxbsCtx ParseTypedC ptcReturnType ptcParametersptcBody ParameterType AntiQuotePlainSomeEqCodecodeCallSafetycodeType codeFunNamecodeDefs getContext setContext emitVerbatim inlineCode inlineExp inlineItems runParserInQtoSomeEq fromSomeEq parseTypedC genericQuoteexppureblockWithPtrs WithPtrsPtrswithPtrs withPtrs_includeverbatimwithPtrwithPtr_contextQuickCheck-2.8.1Test.QuickCheck.Arbitrary Arbitrary mtl-2.1.3.1Control.Monad.Reader.Class MonadReaderbaseGHC.ErrerrorGHC.Baseconstghc-prim GHC.TypesFalse oneOfSizedAnyhow OneOfSized IfPositive identLetter reservedWords identStyle type_nameprettyPointers prettyParams halveSizearbitraryIdentifier!arbitraryDeclarationSpecifierFromarbitraryTypeSpecifierFromarbitraryDeclaratorFromarbitraryIdentifierFromarbitraryDirectDeclaratorFromarbitraryArrayOrProtoFromarbitraryArrayTypeFrom!arbitraryParameterDeclarationFromarbitraryAbstractDeclaratorFrom%arbitraryDirectAbstractDeclaratorFrommany1$fArbitraryPointer$fArbitraryFunctionSpecifier$fArbitraryTypeQualifier $fArbitraryStorageClassSpecifier,$fArbitraryParameterDeclarationWithTypeNames $fPrettyDirectAbstractDeclarator$fPrettyAbstractDeclarator$fPrettyParameterDeclaration$fPrettyArrayType$fPrettyArrayOrProto$fPrettyDirectDeclarator$fPrettyPointer$fPrettyDeclarator$fPrettyFunctionSpecifier$fPrettyTypeQualifier$fPrettyTypeSpecifier$fPrettyStorageClassSpecifier$fPrettyDeclarationSpecifier$fPrettyIdentifier$fIsStringIdentifierfailConversionuntangleDeclarationSpecifiersuntangleDeclaratoruntangleAbstractDeclaratortangleTypeSpecifieruntangleParameterDeclaration'pretty80 $fPrettyType$fPrettyUntangleErr$fMonoidSpecifiersGHC.PtrFunPtruniqueFfiImportName Data.MonoidMonoidmappendtemplate-haskellLanguage.Haskell.TH.SyntaxExpvector-0.10.12.3Data.Vector.StorableVectorForeign.C.TypesCIntbytestring-0.10.4.0Data.ByteString.Internal ByteStringbaseTypesTable getHsVariable convertType_funPtrAntiQuotervecPtrAntiQuotervecLenAntiQuoterbsPtrAntiQuoterbsLenAntiQuoter$fVecCtxMVector$fVecCtxVector$fMonoidContextinitialiseModuleStatemoduleStateRef ModuleState msModuleName msContextmsGeneratedNames Data.MaybeNothinggetModuleStatebumpGeneratedNames cSourceLocremoveIfExists uniqueCName quoteCode prettyOneLine $fShowSomeEq $fEqSomeEqForeign.Marshal.Allocalloca$fWithPtrs(,,,,,,)$fWithPtrs(,,,,,)$fWithPtrs(,,,,)$fWithPtrs(,,,)$fWithPtrs(,,) $fWithPtrs(,)CCharCSCharCUCharCShortCUShortCUIntCLongCULongCLLongCULLongCFloatCDoubleCPtrdiffCSizeCWchar CSigAtomicCClockCTime CUSeconds CSUSecondsCFileCFposCJmpBufCIntPtrCUIntPtrCIntMaxCUIntMax