!#\      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ Noneinline-c$( [t| CDouble -> \ CDouble |] , generates a foreign import wrapper of type (CDouble -> \ CDouble) -> \ (] (CDouble -> \ CDouble)) And invokes it.inline-c$( 'foo), if foo :: CDouble -> \ CDouble#, splices in an expression of type \ (] (CDouble -> \ CDouble)).inline-c$( [t| CDouble -> \ CDouble |]), generates a foreign import dynamic of type ] (CDouble -> \ CDouble) -> (CDouble -> \ CDouble) And invokes it.^None,2456=>?@AMSX0 Binline-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.Cinline-cA type for C identifiers.Hinline-c@Function used to determine whether an identifier is a type name.Iinline-c@Parses an identifier, *without consuming whitespace afterwards*.Kinline-c&A collection of named types (typedefs)Ninline-cRuns a B using parsec.Oinline-c Useful for quick testing. Uses "quickCParser" as source name, and throws an _ if parsing fails.Pinline-cLike O , but uses M (` a) as E.binline-cSame as c=, but does not check that the identifier is not a type name.cinline-cThis parser parses a CG and nothing else -- it does not consume trailing spaces and the like.Ninline-c Source name.inline-cString to parse.inline-cParser. Anything with type forall m. CParser i m => m a is a valid argument.Oinline-cString to parse.inline-cParser. Anything with type forall m. CParser i m => m a is a valid argument.Pinline-cString to parse.inline-cParser. Anything with type forall m. CParser i m => m a is a valid argument.a  !"#$%&'()*5+,-./012346789:;<=>@A?BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcaKEFGHIJCDLMBNOPX=>@A?T789:;<U*5+,-./012346V&'()Y$%Z !"#[^\]_ a` bcRSQWNone"#,24567=>?PX4E$%&'()789:;<BCDEKLMNOPECDL789:;<&'()$%KBEMNOPNone,2>MX?EHSVXinline-c1Type class used to implement the anti-quoters in .inline-c An alias for e.inline-cA 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 f instance, where g is right-biased -- in g x y y will take precedence over x.inline-c+Needed to convert C types to Haskell types.inline-c+Needed to parse and process antiquotations.inline-cThis function is used to post-process the functions generated from the C snippets. Currently just used to specify C linkage when generating C++ code.inline-cTH.LangC by defaultinline-cExistential wrapper around  . inline-cAn identifier for a  . inline-cParses 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.inline-c(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 h 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.inline-cTA data type to indicate whether the user requested pure or IO function from Haskellinline-cA mapping from Ys to Haskell types. Needed both to parse C types, and to convert them to Haskell types.inline-c7Context useful to work with vanilla C. Used by default.3: converts C basic types to their counterparts in Foreign.C.Types.No .inline-cGiven a , it uses its  to convert arbitrary C types.inline-cThis  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.inline-cThis  includes a  1 that removes the need for explicitely creating ] s, named "fun"O along with one which allocates new memory which must be manually freed named  "fun-alloc".%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 i6. We provide utilities to easily allocate them (see  ).IMPORTANT: When using the  fun-allocn anti quoter, one must free the allocated function pointer. The GHC runtime provides a function to do this, hs_free_fun_ptr available in the   header.inline-cThis  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 (j) 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 j 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   k.inline-c$ serves exactly the same purpose as , but only for l. 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*. Moreover, bs-cstr works as bs-ptr6 but it provides a null-terminated copy of the given l.          None"#,2>EPSUVXminline-cData to parse for the funPtr quasi-quoter.)inline-cVData 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.+inline-cSafety of the foreign call.,inline-cType of the foreign call.-inline-c/Name of the function to call in the code below..inline-c The C code./inline-cIf n, the type will be wrapped in ]4, and the call will be static (e.g. prefixed by &).oinline-cMake sure that moduleStatesVar- and the respective C file are up to date.0inline-cGets the current ;. Also makes sure that the current module is initialised.1inline-c 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.2inline-cBSimply appends some string to the module's C file. Use with care.3inline-c/Inlines a piece of code inline. The resulting h& 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; }") 4inline-cSame 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)") 5inline-cSame as 3\, 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 False [t| Double -> Double |] (quickCParser_ "double" parseType) [("x", quickCParser_ "double" parseType)] "return cos(x);") oinline-cThe ) to use if we initialise the module. If p,  will be used.4inline-cSafety of the foreign callinline-cType of the foreign callinline-cReturn type of the C exprinline-cParameters of the C exprinline-cThe C expression5inline-cSafety of the foreign callinline-c$Whether to return as a FunPtr or notinline-c'Optional postfix for the generated nameinline-cType of the foreign callinline-cReturn type of the C exprinline-cParameters of the C exprinline-c The C items9inline-c>Returns the return type, the captured variables, and the body.qinline-c The parser:inline-c-Function building an Haskell expression, see 4! for guidance on the other args.;inline-c(Returns the type and the body separately !"#$%&'()*+,-./0123456789:;<102)*+,-./345(78%&' !"#$96;:<NoneCinline-cC expressions.Dinline-c Variant of C9, 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 DK may endanger referential transparency, and in principle even type safety.Einline-c C code blocks (i.e. statements).CDECDENoneUFinline-cC expressions.Ginline-c Variant of F9, 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 GK may endanger referential transparency, and in principle even type safety.Hinline-c C code blocks (i.e. statements).FGHFGHNone"#&'HUVXM Iinline-cOType 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) ... Minline-cC expressions.Ninline-c Variant of M9, 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 NK may endanger referential transparency, and in principle even type safety.Oinline-c C code blocks (i.e. statements).Pinline-c Easily get a FunPtr: Zlet fp :: FunPtr (Ptr CInt -> IO ()) = [C.funPtr| void poke42(int *ptr) { *ptr = 42; } |] =Especially useful to generate finalizers that require C code.+Most importantly, this allows you to write  invocations conveniently: do let c_finalizer_funPtr = [C.funPtr| void myfree(char * ptr) { free(ptr); } |] fp <- newForeignPtr c_finalizer_funPtr objPtr Using where possible B is superior to resorting to its delayed-by-a-thread alternative  from Foreign.Concurrent which takes an IO ()4 Haskell finaliser action: With the non-concurrent  newForeignPtr; you can guarantee that the finaliser will actually be runwhen a GC is executed under memory pressure, because it can point directly to a C function that doesn't have to run any Haskell code (which is problematic when you're out of memory)when the program terminates ('s finaliser will likely NOT be called if your main thread exits, making your program e.g. not Valgrind-clean if your finaliser is free or C++'s delete).P makes the normal  newForeignPtr. as convenient as its concurrent counterpart.Qinline-cEmits 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> Rinline-c^Emits an arbitrary C string to the C code associated with the current module. Use with care.Sinline-cLike r%, but also peeks the contents of the e9 and returns them once the provided action has finished.Uinline-c 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.Mstuvwxyz{|k}~IJKLMNOPQRSTUUMNOQRSTIJKLP   !!"#$%&'()*+',--./0123456789:;<=>?@ABCDEFGHIC620JKLMMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~6()6B@Anv      !"#$%&'()*+,-./0123423456782349:;<=>?@ABCDEFGHI JGKLGMNEFOPQRGHGMSGMTUVWGXYZ[\G]^_`abEFcdGefgGhiG]jG]jG]kG]kG]lG]lG]mG]mG]nG]nG]^G]oG]oG]pG]pG]qG]qG]rG]rG]sG]sG]tG]tG]uG]uG]vG]vG]wG]wG]xG]xG]yG]yG]zG]zG]{G]{G]|G]|G]}G]}G]~G]~G]G]G]G]G]G]G]G]G]G]G]'inline-c-0.7.0.1-KobIMO62tjK8SpJD7rOCqELanguage.C.InlineLanguage.C.Types.ParseLanguage.C.Types#Language.C.Inline.HaskellIdentifierLanguage.C.Inline.ContextLanguage.C.Inline.InternalLanguage.C.Inline.UnsafeLanguage.C.Inline.InterruptibleLanguage.C.Inline.FunPtrmkFunPtrHsFFIhVIOVectorForeign.ForeignPtr newForeignPtrForeign.ConcurrentmkFunPtrFromName peekFunPtrDirectAbstractDeclaratorArrayOrProtoHereArrayOrProtoThereAbstractDeclaratorParensAbstractDeclaratorabstractDeclaratorPointersabstractDeclaratorDirectDeclaratorOrAbstractDeclarator IsDeclaratorIsAbstractDeclaratorParameterDeclarationparameterDeclarationSpecifiersparameterDeclarationDeclaratorPointer ArrayType VariablySizedUnsizedSizedByIntegerSizedByIdentifier ArrayOrProtoArrayProtoDirectDeclaratorDeclaratorRootDeclaratorParens DeclaratordeclaratorPointersdeclaratorDirectFunctionSpecifierINLINE TypeQualifierCONSTRESTRICTVOLATILE TypeSpecifierVOIDCHARSHORTINTLONGFLOATDOUBLESIGNEDUNSIGNEDStructEnumTypeNameStorageClassSpecifierTYPEDEFEXTERNSTATICAUTOREGISTERDeclarationSpecifierCParser CIdentifier unCIdentifierCParserContext cpcIdentName cpcTypeNames cpcParseIdentcpcIdentToString TypeNamescIdentifierFromStringcCParserContext runCParser quickCParser quickCParser_cReservedWords cIdentStart cIdentLetterdeclaration_specifiersstorage_class_specifiertype_specifier isTypeNameidentifier_no_lextype_qualifierfunction_specifier declaratorarray_or_proto array_typedirect_declaratorpointerparameter_listparameter_declarationabstract_declaratordirect_abstract_declarator$fPrettyCIdentifier$fIsStringCIdentifier$fPrettyStorageClassSpecifier$fPrettyTypeSpecifier$fPrettyTypeQualifier$fPrettyFunctionSpecifier$fPrettyDeclarationSpecifier$fPrettyArrayType$fPrettyPointer $fPrettyDirectAbstractDeclarator$fPrettyAbstractDeclarator$fPrettyParameterDeclaration$fPrettyArrayOrProto$fPrettyDirectDeclarator$fPrettyDeclarator$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 UntangleErrMultipleDataTypes NoDataTypesIllegalSpecifiersparameterDeclarationIdparameterDeclarationTypeSignSignedUnsignedTypePtr SpecifiersstorageClassSpecifierstypeQualifiersfunctionSpecifiersVoidCharShortIntLongLLongFloatDoubleLDoubleuntangleParameterDeclarationtangleParameterDeclarationdescribeParameterDeclaration describeTypeparseParameterDeclarationparseParameterListparseIdentifier parseType$fMonoidSpecifiers$fSemigroupSpecifiers $fPrettyType$fPrettyUntangleErr$fShowSpecifiers$fEqSpecifiers $fShowSign$fEqSign $fOrdSign$fOrdTypeSpecifier $fShowType$fEqType $fFunctorType$fFoldableType$fTraversableType$fShowUntangleErr$fEqUntangleErrHaskellIdentifierunHaskellIdentifierhaskellIdentifierFromStringhaskellCParserContexthaskellReservedWordsparseHaskellIdentifiermangleHaskellIdentifier$fPrettyHaskellIdentifier$fIsStringHaskellIdentifier$fEqHaskellIdentifier$fOrdHaskellIdentifier$fShowHaskellIdentifier$fHashableHaskellIdentifierVecCtx VecCtxScalar vecCtxLengthvecCtxUnsafeWithCArrayContext ctxTypesTablectxAntiQuoters ctxOutputctxForeignSrcLang AntiQuotersSomeAntiQuoter AntiQuoterId AntiQuoteraqParser aqMarshallerPurityPureIO TypesTablebaseCtx convertTypetypeNamesFromTypesTablefptrCtxfunCtxvecCtxbsCtx$fMonoidContext$fSemigroupContext$fVecCtxMVector$fVecCtxVector $fEqPurity $fShowPurity ParseTypedC ptcReturnType ptcParametersptcBody ParameterTypePlain AntiQuoteSomeEqCodecodeCallSafetycodeType codeFunNamecodeDefs codeFunPtr getContext setContext emitVerbatim inlineCode inlineExp inlineItems runParserInQtoSomeEq fromSomeEq parseTypedC genericQuote splitTypedC funPtrQuote $fShowSomeEq $fEqSomeEq$fShowParameterType$fEqParameterType$fEqFunPtrDecl$fShowFunPtrDeclexppureblockWithPtrs WithPtrsPtrswithPtrs withPtrs_funPtrincludeverbatimwithPtrwithPtr_context$fWithPtrs(,,,,,,)$fWithPtrs(,,,,,)$fWithPtrs(,,,,)$fWithPtrs(,,,)$fWithPtrs(,,) $fWithPtrs(,)ghc-prim GHC.TypesbaseGHC.PtrFunPtruniqueFfiImportNameGHC.ErrerrorGHC.BaseconstFalsecidentifier_rawcidentifier_no_lexhaskellIdentStyleMonoidmappendtemplate-haskellLanguage.Haskell.TH.SyntaxExp Foreign.PtrfreeHaskellFunPtr&vector-0.12.0.2-H1Eu1OCXL0L9y980iV8EwUData.Vector.StorableVectorForeign.C.TypesCIntbytestring-0.10.8.2Data.ByteString.Internal ByteString FunPtrDeclTrueinitialiseModuleState GHC.MaybeNothing quoteCodeForeign.Marshal.AllocallocaCCharCSCharCUCharCShortCUShortCUIntCLongCULongCLLongCULLongCBoolCFloatCDoubleCPtrdiffCSizeCWchar CSigAtomicCClockCTime CUSeconds CSUSecondsCFileCFposCJmpBufCIntPtrCUIntPtrCIntMaxCUIntMax