<     [2013] Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None !"#$%&'()*+,-./01234567'*+,-./01234567 !"#$%&'()*+,-./01234567[2013] Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None89:;<=89<=89:;<=#[2013..2014] Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@justtesting.org> experimentalnon-portable (GHC extensions)None!"24>_Hints imply marshalling strategies, which include source and destination types for marshalling.Annotating entities with hints.The alternatives are to provide an explicit marshalling hint with '(:>)', or to leave the marshalling implicitly defined by the name's type. SWe provide additional syntax where the hint is to the left of the annotated entity. !Annotation for irrelevant results?!Pretty print an annotated entity.@BDetermine the Haskell type implied for the given annotated entity.ATDetermine the foreign type *directly* implied for the given annotated entity if any.BRemove the annotation.>CD In case of E5, the foreign type is determined by the Haskell type.F ?@ABGH >CDF ?@AB >CDF ?@ABGH2014 Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@justtesting.org> experimentalnon-portable (GHC extensions)None!"24IHProject the name of the head of a type term if it is a type constructor.JLike I1, but fail if the head is not a type constructor.K@Decompose an n-ary type application into its head and arguments.L;Obtain the data constructor of the newtype in an idiomatic  wrapper of the form <newtype Wrapper <tvs> = Wrapper (ForeignPtr (Wrapper <tvs>))MAUnwraps a newtype wrapper around a foreign pointer and turns the  into a N.O]Generate code that unwraps the foreign pointer inside the given foreign pointer wrapper type.PQGiven a type whose head is a newtype wrapper around a foreign pointer of the form <newtype Wrapper <tvs> = Wrapper (ForeignPtr (Wrapper <tvs>))Ireturn the name of the wrapper data constructor and type argument of the , where all '<tvs>' have been substituted by the arguments in the type application constituting the input type (might be nullary).IJKLMOPIJLMOIJKLMOP2014 Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@justtesting.org> experimentalnon-portable (GHC extensions)None!"24 Hint indicating to marshal an Objective-C object as a foreign pointer, where the argument is the Haskell type representing the Objective-C class. The Haskell type name must coincide with the Objective-C class name./Class of entities that can be used as TH types. QRSTU  QRSTU[2013] Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)NoneFVQConstructs C code to marshal an argument (used to marshal arguments and results).=The argument is the identifier of the value to be marshalled.?The result of the generated expression is the marshalled value.WSConstructs Haskell code to marshal a value (used to marshal arguments and results).GThe first argument is the code referring to the value to be marshalled.VThe second argument is the continuation that gets the marshalled value as an argument.X9Determine the C type that we map a given Haskell type to.YDetermine the C type that we map a given Haskell type constructor to  i.e., we map all Haskell types whose outermost constructor is the given type constructor to the returned C type.xAll types representing boxed values that are not explicitly mapped to a specific C type, are mapped to stable pointers.ZhGenerate the type-specific marshalling code for Haskell to C land marshalling for a Haskell-C type pair.(The result has the following components:,Haskell type after Haskell-side marshalling.!C type before C-side marshalling.0Generator for the Haskell-side marshalling code.*Generator for the C-side marshalling code.[hGenerate the type-specific marshalling code for Haskell to C land marshalling for a C-Haskell type pair.(The result has the following components:,Haskell type after Haskell-side marshalling.!C type before C-side marshalling.0Generator for the Haskell-side marshalling code.*Generator for the C-side marshalling code. VWXY\]Z^[_`aVWXZ[ VWXY\]Z^[_`a[2013] Manuel M T ChakravartyBSD3-Manuel M T Chakravarty <chak@cse.unsw.edu.au> experimentalnon-portable (GHC extensions)None {Maps a quoted property to a quoted projection and a quoted update function in addition to the type of the projected value.Specify imported Objective-C files. Needs to be spliced where an import declaration can appear. (Just put it straight after all the import statements in the module.)SNB: This inline splice must appear before any other use of inline code in a module.XFIXME: need to use TH.addDependentFile on each of the imported ObjC files & read headersBInline Objective-C top-level definitions for a header file ('.h').KInline Objective-C top-level definitions for an implementation file ('.m').dThe top-level Haskell variables given in the first argument will be foreign exported to be accessed from the generated Objective-C code. In C, these Haskell variables will always be represented as functions. (In particular, if the Haskell variable refers to a CAF, it will be a nullary function in C  after all, a thunk may still need to be evaluated.);Map a property to explicit projection and update functions.gMap a property to a field label. This function assumes that the field name is typed and can be reified.cSpecification of a bridge for a Haskell structure that can be queried and updated from Objective-C.The first argument is the name of the Objective-C class that will be a proxy for the Haskell structure. The second argument the name of the Haskell type of the bridged Haskell structure.The generated class is immutable. When a property is updated, a new instance is allocated. This closely mirrors the behaviour of the Haskell structure for which the class is a proxy.@The designated initialiser of the generated class is '[-initWith HsNameHsPtr:(HsStablePtr)particleHsPtr]', where '<HsName>' is the type name of the Haskell structure. This initialiser is generated if it is not explicitly provided. The generated method '[-init]' calls the designated initialiser with nil for the stable pointer.WWARNING: This is a very experimental feature and it will SURELY change in the future!!!MFIXME: don't generate the designated initialiser if it is explicitly providedDeclare a Haskell -UObjective-C marshaller pair to be used in all subsequent marshalling code generation.wOn the Objective-C side, the marshallers must use a wrapped foreign pointer to an Objective-C class (just as those of  g hints). The domain and codomain of the two marshallers must be the opposite and both are executing in b.Inline Objective-C expression.!The inline expression will be wrapped in a C function whose arguments are marshalled versions of the Haskell variables given in the first argument. The marshalling of the variables and of the result is determined by the marshalling annotations at the variables and the inline expression.Emit the Objective-C file and return the foreign declarations. Needs to be the last use of an 'objc...' function. (Just put it at the end of the Haskell module.)HForce type checking of all declaration appearing earlier in this module.Template Haskell performs type checking on declaration groups seperated by toplevel splices. In order for a type declaration to be available to an Objective-C inline directive, the type declaration must be in an earlier declaration group than the Objective-C inline directive. A toplevel Objective-C inline directive always is the start of a new declaration group; hence, it can be considered to be implicitly preceded by an .cdeprefix of the class name class name9name of the Haskell type of the bridged Haskell structure*Haskell variables used in Objective-C codeRObjective-C properties with corresponding Haskell projections and update functionsextra interface declarations!extra implementation declarationsfghijPklmnopqrstuvwxyz{|}~  cdefghij         !"#$%&'(()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP QRSTUVWXYZ [\]^_`abcdefghijklmnopqrstuvwxyz {| {| {} {} {~ {~ { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { { {language-c-inline-0.7.8.0Language.C.Inline.ObjCLanguage.C.Inline.StateLanguage.C.Inline.ErrorLanguage.C.Inline.HintLanguage.C.Inline.THLanguage.C.Inline.ObjC.HintLanguage.C.Inline.ObjC.Marshaltemplate-haskellLanguage.Haskell.TH.SyntaxNamebaseGHC.ForeignPtr ForeignPtrForeign.C.ErrorErrnoForeign.C.StringCString CStringLenCWString CWStringLencastForeignPtr AnnotatedTyped:><:voidClassIsTypePropertyAccess objc_importobjc_interfaceobjc_implementation==>--> objc_recordobjc_marshallerobjc objc_emitobjc_typecheckState foreignTable foreignLabelsheaders marshallers hoistedObjC_h hoistedObjC_m hoistedHSCustomMarshallerstate initialStateinitialiseState readState modifyStatesetForeignTable stashHeaderstashMarshaller stashObjC_h stashObjC_mstashHSextendJumpTablegetForeignTablegetForeignLabels getHeadersgetMarshallerslookupMarshallergetHoistedObjC getHoistedHSreportErrorWithLangreportErrorAndFailreportErrorAndFail'showLangtryWithPlaceholderprettyQCHintannotatedShowQ haskellTypeOf foreignTypeOfstripAnnotation haskellType foreignType Data.MaybeNothingshowQ$fHintQ $fHintName headTyConNameheadTyConNameOrError splitAppTyforeignWrapperDataconptrOfForeignPtrWrapperGHC.PtrPtrunwrapForeignPtrWrapperdecomposeForeignPtrWrappertheType $fHintClass $fIsTypeName $fIsTypeQ $fIsTypeType CMarshallerHaskellMarshallerhaskellTypeToCTypehaskellTypeNameToCTypegenerateHaskellToCMarshallergenerateCToHaskellMarshallerhaskellToCTypeMap isCPtrTypegenerateHaskellToCMarshaller'generateCToHaskellMarshaller' cIntegralMap cFloatingMapghc-prim GHC.TypesIO:==>maybeErrorCtypeforExpDhaskellWrapperTypewrapperBodyTypegenerateCWrappercParamsgenerateHSCallForeign.C.TypesCCharCSCharCUCharCShortCUShortCIntCUIntCLongCULongCLLongCULLongCFloatCDoubleCPtrdiffCSizeCWchar CSigAtomicCClockCTime CUSeconds CSUSecondsCFileCFposCJmpBufCIntPtrCUIntPtrCIntMaxCUIntMax