hs-bindgen-1.0.0.0: test-artefacts/fixtures/declarations/definitions/th.txt
-- addDependentFile test-artefacts/headers/golden/declarations/definitions.h
-- #include <declarations/definitions.h>
-- signed int hs_bindgen_9cdc88a6d09442d6 (
-- double arg1
-- )
-- {
-- return (foo)(arg1);
-- }
-- signed int hs_bindgen_07fd5b433f381094 (
-- double arg1
-- )
-- {
-- return (foo)(arg1);
-- }
-- /* test_declarationsdefinitions_Example_get_foo */
-- __attribute__ ((const))
-- signed int (*hs_bindgen_8bb82cd68ce8efe4 (void)) (
-- double arg1
-- )
-- {
-- return &foo;
-- }
-- /* test_declarationsdefinitions_Example_get_n */
-- __attribute__ ((const))
-- signed int *hs_bindgen_417f0d4479c97357 (void)
-- {
-- return &n;
-- }
{-| __C declaration:__ @struct X@
__defined at:__ @declarations\/definitions.h 23:8@
__exported by:__ @declarations\/definitions.h@
-}
data X
= X {x_n :: CInt
{- ^ __C declaration:__ @n@
__defined at:__ @declarations\/definitions.h 23:16@
__exported by:__ @declarations\/definitions.h@
-}}
deriving stock (Eq, Generic, Show)
instance StaticSize X
where staticSizeOf = \_ -> 4 :: Int
staticAlignment = \_ -> 4 :: Int
instance ReadRaw X
where readRaw = \ptr_0 -> pure X <*> readRaw (Proxy @"x_n") ptr_0
instance WriteRaw X
where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
X x_n_2 -> writeRaw (Proxy @"x_n") ptr_0 x_n_2
deriving via (EquivStorable X) instance Storable X
deriving via (IsStructViaReadRaw X) instance IsStruct X
instance (~) ty CInt => HasField "x_n" X ty
where hasField = \x_0 -> (\y_1 -> X{x_n = y_1},
getField @"x_n" x_0)
instance (~) ty CInt => HasField "x_n" (Ptr X) (Ptr ty)
where getField = fromPtr (Proxy @"x_n")
instance HasCField X "x_n"
where type CFieldType X "x_n" = CInt
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @union Y@
__defined at:__ @declarations\/definitions.h 26:7@
__exported by:__ @declarations\/definitions.h@
-}
newtype Y = Y {unwrapY :: ByteArray} deriving stock Generic
deriving via (SizedByteArray 4 4) instance StaticSize Y
deriving via (SizedByteArray 4 4) instance ReadRaw Y
deriving via (SizedByteArray 4 4) instance WriteRaw Y
deriving via (EquivStorable Y) instance Storable Y
deriving via (SizedByteArray 4 4) instance IsUnion Y
instance (~) ty CInt => HasField "y_m" Y ty
where getField = getUnionPayload
instance (~) ty CInt => HasField "y_m" Y ty
where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
getField @"y_m" x_0)
instance (~) ty CInt => HasField "y_m" (Ptr Y) (Ptr ty)
where getField = fromPtr (Proxy @"y_m")
instance HasCField Y "y_m"
where type CFieldType Y "y_m" = CInt
offset# = \_ -> \_ -> 0
instance (~) ty CInt => HasField "y_o" Y ty
where getField = getUnionPayload
instance (~) ty CInt => HasField "y_o" Y ty
where hasField = \x_0 -> (\y_1 -> setUnionPayload y_1 x_0,
getField @"y_o" x_0)
instance (~) ty CInt => HasField "y_o" (Ptr Y) (Ptr ty)
where getField = fromPtr (Proxy @"y_o")
instance HasCField Y "y_o"
where type CFieldType Y "y_o" = CInt
offset# = \_ -> \_ -> 0
-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
foreign import ccall safe "hs_bindgen_9cdc88a6d09442d6" hs_bindgen_9cdc88a6d09442d6_base ::
CDouble
-> IO CInt
-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
hs_bindgen_9cdc88a6d09442d6 :: CDouble -> IO CInt
-- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@
hs_bindgen_9cdc88a6d09442d6 = \x_0 -> fmap fromFFIType (hs_bindgen_9cdc88a6d09442d6_base (toFFIType x_0))
{-| __C declaration:__ @foo@
__defined at:__ @declarations\/definitions.h 13:5@
__exported by:__ @declarations\/definitions.h@
-}
foo_safe :: CDouble -> IO CInt
{-| __C declaration:__ @foo@
__defined at:__ @declarations\/definitions.h 13:5@
__exported by:__ @declarations\/definitions.h@
-}
foo_safe = hs_bindgen_9cdc88a6d09442d6
-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
foreign import ccall unsafe "hs_bindgen_07fd5b433f381094" hs_bindgen_07fd5b433f381094_base ::
CDouble
-> IO CInt
-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
hs_bindgen_07fd5b433f381094 :: CDouble -> IO CInt
-- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@
hs_bindgen_07fd5b433f381094 = \x_0 -> fmap fromFFIType (hs_bindgen_07fd5b433f381094_base (toFFIType x_0))
{-| __C declaration:__ @foo@
__defined at:__ @declarations\/definitions.h 13:5@
__exported by:__ @declarations\/definitions.h@
-}
foo_unsafe :: CDouble -> IO CInt
{-| __C declaration:__ @foo@
__defined at:__ @declarations\/definitions.h 13:5@
__exported by:__ @declarations\/definitions.h@
-}
foo_unsafe = hs_bindgen_07fd5b433f381094
-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
foreign import ccall unsafe "hs_bindgen_8bb82cd68ce8efe4" hs_bindgen_8bb82cd68ce8efe4_base ::
IO (FunPtr Void)
-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
hs_bindgen_8bb82cd68ce8efe4 :: IO (FunPtr (CDouble -> IO CInt))
-- __unique:__ @test_declarationsdefinitions_Example_get_foo@
hs_bindgen_8bb82cd68ce8efe4 = fmap fromFFIType hs_bindgen_8bb82cd68ce8efe4_base
{-# NOINLINE foo_funptr #-}
{-| __C declaration:__ @foo@
__defined at:__ @declarations\/definitions.h 13:5@
__exported by:__ @declarations\/definitions.h@
-}
foo_funptr :: FunPtr (CDouble -> IO CInt)
{-| __C declaration:__ @foo@
__defined at:__ @declarations\/definitions.h 13:5@
__exported by:__ @declarations\/definitions.h@
-}
foo_funptr = unsafePerformIO hs_bindgen_8bb82cd68ce8efe4
-- __unique:__ @test_declarationsdefinitions_Example_get_n@
foreign import ccall unsafe "hs_bindgen_417f0d4479c97357" hs_bindgen_417f0d4479c97357_base ::
IO (Ptr Void)
-- __unique:__ @test_declarationsdefinitions_Example_get_n@
hs_bindgen_417f0d4479c97357 :: IO (Ptr CInt)
-- __unique:__ @test_declarationsdefinitions_Example_get_n@
hs_bindgen_417f0d4479c97357 = fmap fromFFIType hs_bindgen_417f0d4479c97357_base
{-# NOINLINE n #-}
{-| __C declaration:__ @n@
__defined at:__ @declarations\/definitions.h 18:5@
__exported by:__ @declarations\/definitions.h@
-}
n :: Ptr CInt
{-| __C declaration:__ @n@
__defined at:__ @declarations\/definitions.h 18:5@
__exported by:__ @declarations\/definitions.h@
-}
n = unsafePerformIO hs_bindgen_417f0d4479c97357