-- addDependentFile examples/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 Unit)}
      {- ^ 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@
      -}
    deriving newtype HasFFIType
foreign import ccall safe "wrapper" hs_bindgen_5964bbadb359ee4a_base ::
    Ptr Void -> IO Unit
 -> IO (FunPtr (Ptr Void -> IO Unit))
-- __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 castFunPtrFromFFIType (hs_bindgen_5964bbadb359ee4a_base (toFFIType fun_0))
foreign import ccall safe "dynamic" hs_bindgen_f8391e85af67fcb6_base ::
    FunPtr (Ptr Void -> IO Unit)
 -> Ptr Void
 -> IO Unit
-- __unique:__ @fromFun_ptr_Aux@
hs_bindgen_f8391e85af67fcb6 :: FunPtr Fun_ptr_Aux -> Fun_ptr_Aux
-- __unique:__ @fromFun_ptr_Aux@
hs_bindgen_f8391e85af67fcb6 = \funPtr_0 -> fromFFIType (hs_bindgen_f8391e85af67fcb6_base (castFunPtrToFFIType funPtr_0))
instance ToFunPtr Fun_ptr_Aux
    where toFunPtr = hs_bindgen_5964bbadb359ee4a
instance FromFunPtr Fun_ptr_Aux
    where fromFunPtr = hs_bindgen_f8391e85af67fcb6
instance TyEq ty (CFieldType Fun_ptr_Aux "unwrapFun_ptr_Aux") =>
         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 Unit
          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)}
      {- ^ __C declaration:__ @fun_ptr@

           __defined at:__ @functions\/circular_dependency_fun.h 3:16@

           __exported by:__ @functions\/circular_dependency_fun.h@
      -}
    deriving stock (Eq, Ord, Show)
    deriving newtype (StaticSize,
                      ReadRaw,
                      WriteRaw,
                      Storable,
                      HasFFIType)
instance TyEq ty (CFieldType Fun_ptr "unwrapFun_ptr") =>
         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@
                           -}}
      {- ^ __C declaration:__ @struct forward_declaration@

           __defined at:__ @functions\/circular_dependency_fun.h 5:8@

           __exported by:__ @functions\/circular_dependency_fun.h@
      -}
    deriving stock (Eq, 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
instance HasCField Forward_declaration "forward_declaration_f"
    where type CFieldType Forward_declaration
                          "forward_declaration_f" = Fun_ptr
          offset# = \_ -> \_ -> 0
instance TyEq ty
              (CFieldType Forward_declaration "forward_declaration_f") =>
         HasField "forward_declaration_f" (Ptr Forward_declaration) (Ptr ty)
    where getField = fromPtr (Proxy @"forward_declaration_f")
foreign import ccall safe "wrapper" hs_bindgen_fbe9c5dca66824d3_base ::
    Ptr Void -> IO Unit
 -> IO (FunPtr (Ptr Void -> IO Unit))
-- __unique:__ @instance ToFunPtr ((Ptr.Ptr Forward_declaration) -> IO ())@
hs_bindgen_fbe9c5dca66824d3 :: (Ptr Forward_declaration ->
                                IO Unit) ->
                               IO (FunPtr (Ptr Forward_declaration -> IO Unit))
-- __unique:__ @instance ToFunPtr ((Ptr.Ptr Forward_declaration) -> IO ())@
hs_bindgen_fbe9c5dca66824d3 = \fun_0 -> fmap castFunPtrFromFFIType (hs_bindgen_fbe9c5dca66824d3_base (toFFIType fun_0))
foreign import ccall safe "dynamic" hs_bindgen_b3640137a9cf92cc_base ::
    FunPtr (Ptr Void -> IO Unit)
 -> Ptr Void
 -> IO Unit
-- __unique:__ @instance FromFunPtr ((Ptr.Ptr Forward_declaration) -> IO ())@
hs_bindgen_b3640137a9cf92cc :: FunPtr (Ptr Forward_declaration ->
                                       IO Unit) ->
                               Ptr Forward_declaration -> IO Unit
-- __unique:__ @instance FromFunPtr ((Ptr.Ptr Forward_declaration) -> IO ())@
hs_bindgen_b3640137a9cf92cc = \funPtr_0 -> fromFFIType (hs_bindgen_b3640137a9cf92cc_base (castFunPtrToFFIType funPtr_0))
instance ToFunPtr (Ptr Forward_declaration -> IO Unit)
    where toFunPtr = hs_bindgen_fbe9c5dca66824d3
instance FromFunPtr (Ptr Forward_declaration -> IO Unit)
    where fromFunPtr = hs_bindgen_b3640137a9cf92cc
