?Ha      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` None*02349:;<=IOT Type used to generate an a $ 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.EWe parametrize the parsing by the type of the variable identifiers, i. We do so because we use this parser to implement anti-quoters referring to Haskell variables, and thus we need to parse Haskell identifiers in certain positions.DA type for C identifiers.I@Function used to determine whether an identifier is a type name.J@Parses an identifier, *without consuming whitespace afterwards*.L&A collection of named types (typedefs)ORuns a C using parsec.P Useful for quick testing. Uses "quickCParser" as source name, and throws an b if parsing fails.QLike P , but uses N (c d) as F.eSame as f=, but does not check that the identifier is not a type name.fThis parser parses a DG and nothing else -- it does not consume trailing spaces and the like.g$Precondition: there is at least one h in the list.ijklmhn  !"#$%&'()*+,-./0123456789:;<=>?@ABCDoEFGHIJKLMNO Source name.String to parse.Parser. Anything with type forall m. CParser i m => m a is a valid argument.PString to parse.Parser. Anything with type forall m. CParser i m => m a is a valid argument.QString to parse.Parser. Anything with type forall m. CParser i m => m a is a valid argument.RSTpUVWqrXefstYZ[\]^_`abcuvgwdxyz{|}~efghijklmnopqrstuvwxe  !"#$%&'()*+6,-./012345789:;<=>?AB@CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdfLFGHIJKDEEMNCOPQX>?@ABU89:;<=V+,-./01234567W'()*Y%&Z!"#$[ ^\]_ a` bcSTRdYijklmhn   !"#$%&'()*+ ,-./0123456789:;<=>?@ABCDoEFGHIJKLMNOPQRSTpUVWqrXefstYZ[\]^_`abcuvgwdxyz{|}~efghijklmnopqrstuvwxNone!"*023459:;LT6E%&'()*89:;<=CDEFLMNOPQFDEEM89:;<='()*%&LCFNOPQ None*0:IT(A possibly qualified Haskell identifier.See  Lhttps://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-160002.2.See  Lhttps://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-160002.2. Mangles an  to produce a valid D$ which still sort of resembles the .   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*9:;ADORT1Type 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.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.TH.LangC by defaultExistential wrapper around .An identifier for a .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 .The  has Void@ as an identifier type to make sure that no names appear in it.(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 Ys 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   adds support for  ForeignPtr0 arguments. It adds a unique marshaller called fptr-ptr. For example, $fptr-ptr:(int *x)5 extracts the bare C pointer out of foreign pointer x.#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.IMPORTANT: When using the fun anti quoter, one must be aware that the function pointer which is automatically generated is freed when the code contained in the block containing the anti quoter exits. Thus, if you need the function pointer to be longer-lived, you must allocate it and free it manually using 6. We provide utilities to easily allocate them (see  ).$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 char*.,      !"#$%&'(      !"#$%  ! "#$   %      !"#$%&'(None!"*0:ALOQRT 4VData 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.6Safety of the foreign call.7Type of the foreign call.8/Name of the function to call in the code below.9 The C code.Make sure that moduleStatesVar- 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 7.oIn practice, this function outputs the C code to the module's C file, and then inserts a foreign call of type 7 calling the provided 8.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 4Q. 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);") ++,-./0123456789The  ) 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 expression?Safety of the foreign callType of the foreign callReturn type of the C exprParameters of the C expr The C items@ABC>Returns the return type, the captured variables, and the body. The parserD-Function building an Haskell expression, see >! for guidance on the other args.EF+,-./0123456789:;<=>?@ABCD;:<456789=>?3AB012+,-./C@D+,-./0123456789:;<=>?@ABCDEFNoneIC expressions.J Variant of I9, 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 JK may endanger referential transparency, and in principle even type safety.K C code blocks (i.e. statements).IJKIJKIJKIJKNoneLC expressions.M Variant of L9, 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 MK may endanger referential transparency, and in principle even type safety.N C code blocks (i.e. statements).LMNLMNLMNLMNNone!"%&DQRTOOType 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) ... SC expressions.T Variant of S9, 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 TK may endanger referential transparency, and in principle even type safety.U C code blocks (i.e. statements).VEmits 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> W^Emits an arbitrary C string to the C code associated with the current module. Use with care.XLike %, but also peeks the contents of the 9 and returns them once the provided action has finished.Z 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.OPQRSTUVWXYZ[\]^_`J "#$%OPQRSTUVWXYZ "#$%ZSTUVWXYOPQROPQRSTUVWXYZ[\]^_`   !"#$%&'#())*+,-./0123456789:;<=>?@ABCDE?2.,FGHIIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~2$%2><=nv       !"#$%&'()*+,-./0123423456782349:;<=>?@ABCDEFGHIGJKLMNOPQRSSTUVWGXYZ[\]^_`abcdefghijklmnopqrstulLMGvw xGvGJyGJz{|}G~GGJsGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG'inline-c-0.6.0.3-4tRMy2bPoMPAM2wQvC7qeoLanguage.C.Types.ParseLanguage.C.Types#Language.C.Inline.HaskellIdentifierLanguage.C.InlineLanguage.C.Inline.ContextLanguage.C.Inline.InternalLanguage.C.Inline.InterruptibleLanguage.C.Inline.UnsafeLanguage.C.Inline.FunPtrmkFunPtrVIOVector!ParameterDeclarationWithTypeNamespdwtnTypeNamespdwtnParameterDeclarationDirectAbstractDeclaratorArrayOrProtoHereArrayOrProtoThereAbstractDeclaratorParensAbstractDeclaratorabstractDeclaratorPointersabstractDeclaratorDirectDeclaratorOrAbstractDeclarator IsDeclaratorIsAbstractDeclaratorParameterDeclarationparameterDeclarationSpecifiersparameterDeclarationDeclaratorPointer ArrayType VariablySizedUnsizedSizedByIntegerSizedByIdentifier ArrayOrProtoArrayProtoDirectDeclaratorDeclaratorRootDeclaratorParens DeclaratordeclaratorPointersdeclaratorDirectFunctionSpecifierINLINE TypeQualifierCONSTRESTRICTVOLATILE TypeSpecifierVOIDCHARSHORTINTLONGFLOATDOUBLESIGNEDUNSIGNEDStructEnumTypeNameStorageClassSpecifierTYPEDEFEXTERNSTATICAUTOREGISTERDeclarationSpecifierCParser CIdentifier unCIdentifierCParserContext cpcIdentName cpcTypeNames cpcParseIdentcpcIdentToString TypeNamescIdentifierFromStringcCParserContext runCParser quickCParser quickCParser_cReservedWords cIdentStart cIdentLetterdeclaration_specifiersstorage_class_specifiertype_specifieridentifier_no_lextype_qualifierfunction_specifier declaratorarray_or_proto array_typedirect_declaratorpointerparameter_listparameter_declarationabstract_declaratordirect_abstract_declarator*arbitraryParameterDeclarationWithTypeNames$fArbitraryPointer$fArbitraryFunctionSpecifier$fArbitraryTypeQualifier $fArbitraryStorageClassSpecifier$fArbitraryCIdentifier $fPrettyDirectAbstractDeclarator$fPrettyAbstractDeclarator$fPrettyParameterDeclaration$fPrettyArrayType$fPrettyArrayOrProto$fPrettyDirectDeclarator$fPrettyPointer$fPrettyDeclarator$fPrettyFunctionSpecifier$fPrettyTypeQualifier$fPrettyTypeSpecifier$fPrettyStorageClassSpecifier$fPrettyDeclarationSpecifier$fPrettyCIdentifier$fIsStringCIdentifier$fEqCIdentifier$fOrdCIdentifier$fShowCIdentifier$fHashableCIdentifier$fEqStorageClassSpecifier$fShowStorageClassSpecifier$fEqTypeSpecifier$fShowTypeSpecifier$fEqTypeQualifier$fShowTypeQualifier$fEqFunctionSpecifier$fShowFunctionSpecifier$fEqDeclarationSpecifier$fShowDeclarationSpecifier $fEqArrayType$fShowArrayType$fFunctorArrayType$fFoldableArrayType$fTraversableArrayType $fEqPointer $fShowPointer$fEqDirectAbstractDeclarator$fShowDirectAbstractDeclarator!$fFunctorDirectAbstractDeclarator"$fFoldableDirectAbstractDeclarator%$fTraversableDirectAbstractDeclarator$fEqAbstractDeclarator$fShowAbstractDeclarator$fFunctorAbstractDeclarator$fFoldableAbstractDeclarator$fTraversableAbstractDeclarator$fEqArrayOrProto$fShowArrayOrProto$fFunctorArrayOrProto$fFoldableArrayOrProto$fTraversableArrayOrProto$fEqParameterDeclaration$fShowParameterDeclaration$fFunctorParameterDeclaration$fFoldableParameterDeclaration!$fTraversableParameterDeclaration"$fEqDeclaratorOrAbstractDeclarator$$fShowDeclaratorOrAbstractDeclarator'$fFunctorDeclaratorOrAbstractDeclarator($fFoldableDeclaratorOrAbstractDeclarator+$fTraversableDeclaratorOrAbstractDeclarator$fEqDeclarator$fShowDeclarator$fFunctorDeclarator$fFoldableDeclarator$fTraversableDeclarator$fEqDirectDeclarator$fShowDirectDeclarator$fFunctorDirectDeclarator$fFoldableDirectDeclarator$fTraversableDirectDeclarator$fEqOneOfSized$fShowOneOfSized%$fEqParameterDeclarationWithTypeNames'$fShowParameterDeclarationWithTypeNames UntangleErrMultipleDataTypes NoDataTypesIllegalSpecifiersparameterDeclarationIdparameterDeclarationTypeSignSignedUnsignedTypePtr SpecifiersstorageClassSpecifierstypeQualifiersfunctionSpecifiersVoidCharShortIntLongLLongFloatDoubleLDoubleuntangleParameterDeclarationtangleParameterDeclarationdescribeParameterDeclaration describeTypeparseParameterDeclarationparseParameterListparseIdentifier parseType $fPrettyType$fPrettyUntangleErr$fMonoidSpecifiers$fShowSpecifiers$fEqSpecifiers $fShowSign$fEqSign $fOrdSign$fOrdTypeSpecifier $fShowType$fEqType $fFunctorType$fFoldableType$fTraversableType$fShowUntangleErr$fEqUntangleErrHaskellIdentifierunHaskellIdentifierhaskellIdentifierFromStringhaskellCParserContextparseHaskellIdentifiermangleHaskellIdentifier$fArbitraryHaskellIdentifier$fPrettyHaskellIdentifier$fIsStringHaskellIdentifier$fEqHaskellIdentifier$fOrdHaskellIdentifier$fShowHaskellIdentifier$fHashableHaskellIdentifiermkFunPtrFromName peekFunPtrVecCtx VecCtxScalar vecCtxLengthvecCtxUnsafeWithCArrayContext ctxTypesTablectxAntiQuoters ctxOutputctxForeignSrcLang AntiQuotersSomeAntiQuoter AntiQuoterId AntiQuoteraqParser aqMarshallerPurityPureIO TypesTablebaseCtx convertTypetypeNamesFromTypesTablefptrCtxfunCtxvecCtxbsCtx$fVecCtxMVector$fVecCtxVector$fMonoidContext $fEqPurity $fShowPurity ParseTypedC ptcReturnType ptcParametersptcBody ParameterTypePlain AntiQuoteSomeEqCodecodeCallSafetycodeType codeFunNamecodeDefs getContext setContext emitVerbatim inlineCode inlineExp inlineItems runParserInQtoSomeEq fromSomeEq parseTypedC genericQuote $fShowSomeEq $fEqSomeEq$fShowParameterType$fEqParameterTypeexppureblockWithPtrs WithPtrsPtrswithPtrs withPtrs_includeverbatimwithPtrwithPtr_context$fWithPtrs(,,,,,,)$fWithPtrs(,,,,,)$fWithPtrs(,,,,)$fWithPtrs(,,,)$fWithPtrs(,,) $fWithPtrs(,)*QuickCheck-2.10.0.1-Ju8QhRI4SL136DVBuvALgeTest.QuickCheck.Arbitrary ArbitrarybaseGHC.ErrerrorGHC.Baseconstghc-prim GHC.TypesFalsecidentifier_rawcidentifier_no_lex oneOfSizedAnyhowArbitraryContext acTypeNamesacIdentToString OneOfSized IfPositive cIdentStyle identifier isTypeName cidentifier type_nameprettyPointers prettyParams halveSize!arbitraryDeclarationSpecifierFromarbitraryTypeSpecifierFromarbitraryDeclaratorFromarbitraryCIdentifierFromarbitraryIdentifierFromarbitraryDirectDeclaratorFromarbitraryArrayOrProtoFromarbitraryArrayTypeFrom!arbitraryParameterDeclarationFromarbitraryAbstractDeclaratorFrom%arbitraryDirectAbstractDeclaratorFrommany1 identNoLexfailConversionuntangleDeclarationSpecifiersuntangleDeclaratoruntangleAbstractDeclaratortangleTypeSpecifieruntangleParameterDeclaration'pretty80haskellIdentStylehaskellReservedWordsGHC.PtrFunPtruniqueFfiImportNameMonoidmappendtemplate-haskellLanguage.Haskell.TH.SyntaxExp Foreign.PtrfreeHaskellFunPtr&vector-0.12.0.1-BtK5bVORdhu8bC6gqUfFYiData.Vector.StorableVectorForeign.C.TypesCIntbytestring-0.10.8.1Data.ByteString.Internal ByteStringbaseTypesTable getHsVariable convertType_fptrAntiQuoterfunPtrAntiQuotervecPtrAntiQuotervecLenAntiQuoterbsPtrAntiQuoterbsLenAntiQuoter cDeclAqParserdeHaskellifyCTypeinitialiseModuleState ModuleState msContextmsGeneratedNames msFileChunksgetModuleStateputModuleStateNothingmodifyModuleStatebumpGeneratedNames uniqueCName quoteCode prettyOneLineForeign.Marshal.AllocallocaCCharCSCharCUCharCShortCUShortCUIntCLongCULongCLLongCULLongCFloatCDoubleCPtrdiffCSizeCWchar CSigAtomicCClockCTime CUSeconds CSUSecondsCFileCFposCJmpBufCIntPtrCUIntPtrCIntMaxCUIntMax