-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate FFI import declarations from C include files -- -- Haskell FFI Binding Modules Generator (HSFFIG) is a tool that parses C -- library include files (.h) and generates Haskell Foreign Functions -- Interface import declarations for all functions, #define'd constants -- (where possible), enumerations, and structures/unions (to access their -- members). It is assumed that the GNU C Compiler and Preprocessor are -- used. Auto-generated Haskell modules may be imported into an -- application to get access to the foreign library's functions and -- variables. -- -- The package provides a small library that programs using -- auto-generated imports have to link to (specify HSFFIG as one of -- build-depends), and two executable programs: -- -- -- -- Please note that hsffig and ffipkg will likely not -- work properly with C++ include files. @package HSFFIG @version 1.1 module HSFFIG.FieldAccess -- | A multi-parameter class with functional dependencies is declared to -- enable access to structures/unions members. The functional -- dependencies a b c | a c -> b specify that type of -- b (type of the member) depends entirely on the types a -- (phantom type identifying structure/union) and c (phantom type -- identifying the member, a.k.a. member selector), and there may be only -- one type of b for every possible combination of a and -- c. -- -- Indeed: -- --
--   struct a {
--     int x;
--   };
--   struct b {
--     float x;
--   };
--   
-- -- both structures contain a member with the same name, but different -- types. -- -- HSFFIG will generate the following instances for the structures above: -- --
--   instance HSFFIG.FieldAccess.FieldAccess S_a ((CInt)) V_x where
--     z --> V_x = (#peek __quote__(struct a), x) z
--     (z, V_x) <-- v = (#poke __quote__(struct a), x) z v
--   ...
--   instance HSFFIG.FieldAccess.FieldAccess S_b ((CFloat)) V_x where
--    z --> V_x = (#peek __quote__(struct b), x) z
--    (z, V_x) <-- v = (#poke __quote__(struct b), x) z v
--   
-- -- That is, when the member identified by selector V_x is -- fetched from struct a (S_a), an integer value is -- returned. But when the member with the same name is retrieved from -- struct b, a float value is returned. class FieldAccess a b c | a c -> b (==>) :: (FieldAccess a b c) => Ptr a -> c -> b (-->) :: (FieldAccess a b c) => Ptr a -> c -> IO b (<--) :: (FieldAccess a b c) => (Ptr a, c) -> b -> IO ()