hs-bindgen-1.0.0.0: test-artefacts/fixtures/functions/circular_dependency_fun/th.txt
-- addDependentFile test-artefacts/headers/golden/functions/circular_dependency_fun.h
{-| Auxiliary type used by 'Fun_ptr'
__C declaration:__ @fun_ptr@
__defined at:__ @functions\/circular_dependency_fun.h 3:16@
__exported by:__ @functions\/circular_dependency_fun.h@
-}
newtype Fun_ptr_Aux
= Fun_ptr_Aux {unwrapFun_ptr_Aux :: (Ptr Forward_declaration ->
IO ())}
deriving stock Generic
-- __unique:__ @toFun_ptr_Aux@
foreign import ccall safe "wrapper" hs_bindgen_5964bbadb359ee4a_base ::
Ptr Void -> IO ()
-> IO (FunPtr (Ptr Void -> IO ()))
-- __unique:__ @toFun_ptr_Aux@
hs_bindgen_5964bbadb359ee4a :: Fun_ptr_Aux ->
IO (FunPtr Fun_ptr_Aux)
-- __unique:__ @toFun_ptr_Aux@
hs_bindgen_5964bbadb359ee4a = \fun_0 -> fmap castFunPtr (hs_bindgen_5964bbadb359ee4a_base (\x_1 -> getField @"unwrapFun_ptr_Aux" fun_0 (fromFFIType x_1)))
-- __unique:__ @fromFun_ptr_Aux@
foreign import ccall safe "dynamic" hs_bindgen_f8391e85af67fcb6_base ::
FunPtr (Ptr Void -> IO ())
-> Ptr Void
-> IO ()
-- __unique:__ @fromFun_ptr_Aux@
hs_bindgen_f8391e85af67fcb6 :: FunPtr Fun_ptr_Aux -> Fun_ptr_Aux
-- __unique:__ @fromFun_ptr_Aux@
hs_bindgen_f8391e85af67fcb6 = \funPtr_0 -> Fun_ptr_Aux (\x_1 -> hs_bindgen_f8391e85af67fcb6_base (castFunPtr funPtr_0) (toFFIType x_1))
instance ToFunPtr Fun_ptr_Aux
where toFunPtr = hs_bindgen_5964bbadb359ee4a
instance FromFunPtr Fun_ptr_Aux
where fromFunPtr = hs_bindgen_f8391e85af67fcb6
instance (~) ty (Ptr Forward_declaration -> IO ()) =>
HasField "unwrapFun_ptr_Aux" Fun_ptr_Aux ty
where hasField = \x_0 -> (\y_1 -> Fun_ptr_Aux{unwrapFun_ptr_Aux = y_1},
getField @"unwrapFun_ptr_Aux" x_0)
instance (~) ty (Ptr Forward_declaration -> IO ()) =>
HasField "unwrapFun_ptr_Aux" (Ptr Fun_ptr_Aux) (Ptr ty)
where getField = fromPtr (Proxy @"unwrapFun_ptr_Aux")
instance HasCField Fun_ptr_Aux "unwrapFun_ptr_Aux"
where type CFieldType Fun_ptr_Aux
"unwrapFun_ptr_Aux" = Ptr Forward_declaration -> IO ()
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @fun_ptr@
__defined at:__ @functions\/circular_dependency_fun.h 3:16@
__exported by:__ @functions\/circular_dependency_fun.h@
-}
newtype Fun_ptr
= Fun_ptr {unwrapFun_ptr :: (FunPtr Fun_ptr_Aux)}
deriving stock (Eq, Generic, Ord, Show)
deriving newtype (HasFFIType,
ReadRaw,
StaticSize,
Storable,
WriteRaw)
instance (~) ty (FunPtr Fun_ptr_Aux) =>
HasField "unwrapFun_ptr" Fun_ptr ty
where hasField = \x_0 -> (\y_1 -> Fun_ptr{unwrapFun_ptr = y_1},
getField @"unwrapFun_ptr" x_0)
instance (~) ty (FunPtr Fun_ptr_Aux) =>
HasField "unwrapFun_ptr" (Ptr Fun_ptr) (Ptr ty)
where getField = fromPtr (Proxy @"unwrapFun_ptr")
instance HasCField Fun_ptr "unwrapFun_ptr"
where type CFieldType Fun_ptr "unwrapFun_ptr" = FunPtr Fun_ptr_Aux
offset# = \_ -> \_ -> 0
{-| __C declaration:__ @struct forward_declaration@
__defined at:__ @functions\/circular_dependency_fun.h 5:8@
__exported by:__ @functions\/circular_dependency_fun.h@
-}
data Forward_declaration
= Forward_declaration {forward_declaration_f :: Fun_ptr
{- ^ __C declaration:__ @f@
__defined at:__ @functions\/circular_dependency_fun.h 6:11@
__exported by:__ @functions\/circular_dependency_fun.h@
-}}
deriving stock (Eq, Generic, Show)
instance StaticSize Forward_declaration
where staticSizeOf = \_ -> 8 :: Int
staticAlignment = \_ -> 8 :: Int
instance ReadRaw Forward_declaration
where readRaw = \ptr_0 -> pure Forward_declaration <*> readRaw (Proxy @"forward_declaration_f") ptr_0
instance WriteRaw Forward_declaration
where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
Forward_declaration forward_declaration_f_2 -> writeRaw (Proxy @"forward_declaration_f") ptr_0 forward_declaration_f_2
deriving via (EquivStorable Forward_declaration) instance Storable Forward_declaration
deriving via (IsStructViaReadRaw Forward_declaration) instance IsStruct Forward_declaration
instance (~) ty Fun_ptr =>
HasField "forward_declaration_f" Forward_declaration ty
where hasField = \x_0 -> (\y_1 -> Forward_declaration{forward_declaration_f = y_1},
getField @"forward_declaration_f" x_0)
instance (~) ty Fun_ptr =>
HasField "forward_declaration_f" (Ptr Forward_declaration) (Ptr ty)
where getField = fromPtr (Proxy @"forward_declaration_f")
instance HasCField Forward_declaration "forward_declaration_f"
where type CFieldType Forward_declaration
"forward_declaration_f" = Fun_ptr
offset# = \_ -> \_ -> 0