The Binding Generator C->Haskell : Implementation of Haskell Binding Modules : Get Hooks
Previous: Function Hooks
Next: Set Hooks

2.8. Get Hooks

{#get apath#}

A get hook supports accessing a member value of a C structure. The hook itself yields a function that, when given the address of a structure of the right type, performs the structure access. The member that is to be extracted is specified by the access path apath. Access paths are formed as follows (following a subset of the C expression syntax):

For example, we may have

visualGetType              :: Visual -> IO VisualType
visualGetType (Visual vis)  = liftM cToEnum $ {#get Visual->type#} vis


The Binding Generator C->Haskell : Implementation of Haskell Binding Modules : Get Hooks
Previous: Function Hooks
Next: Set Hooks