-- addDependentFile examples/golden/functions/heap_types/struct_const_typedef.h
-- #include <functions/heap_types/struct_const_typedef.h>
-- void hs_bindgen_67465eb5641985dc (
--   T *arg1,
--   T *arg2
-- )
-- {
--   *arg2 = fun(*arg1);
-- }
-- void hs_bindgen_4351e21e32969011 (
--   T *arg1,
--   T *arg2
-- )
-- {
--   *arg2 = fun(*arg1);
-- }
-- /* test_functionsheap_typesstruct_co_Example_get_fun */
-- __attribute__ ((const))
-- T (*hs_bindgen_564814e9ac709cad (void)) (
--   T arg1
-- )
-- {
--   return &fun;
-- }
{-| __C declaration:__ @struct S@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 3:8@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
data S
    = S {s_x :: CInt
         {- ^ __C declaration:__ @x@

              __defined at:__ @functions\/heap_types\/struct_const_typedef.h 4:7@

              __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
         -}}
      {- ^ __C declaration:__ @struct S@

           __defined at:__ @functions\/heap_types\/struct_const_typedef.h 3:8@

           __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
      -}
    deriving stock (Eq, Show)
instance StaticSize S
    where staticSizeOf = \_ -> 4 :: Int
          staticAlignment = \_ -> 4 :: Int
instance ReadRaw S
    where readRaw = \ptr_0 -> pure S <*> readRaw (Proxy @"s_x") ptr_0
instance WriteRaw S
    where writeRaw = \ptr_0 -> \s_1 -> case s_1 of
                                       S s_x_2 -> writeRaw (Proxy @"s_x") ptr_0 s_x_2
deriving via (EquivStorable S) instance Storable S
instance HasCField S "s_x"
    where type CFieldType S "s_x" = CInt
          offset# = \_ -> \_ -> 0
instance TyEq ty (CFieldType S "s_x") =>
         HasField "s_x" (Ptr S) (Ptr ty)
    where getField = fromPtr (Proxy @"s_x")
{-| __C declaration:__ @T@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 7:24@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
newtype T
    = T {unwrapT :: S}
      {- ^ __C declaration:__ @T@

           __defined at:__ @functions\/heap_types\/struct_const_typedef.h 7:24@

           __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
      -}
    deriving stock (Eq, Show)
    deriving newtype (StaticSize, ReadRaw, WriteRaw, Storable)
instance TyEq ty (CFieldType T "unwrapT") =>
         HasField "unwrapT" (Ptr T) (Ptr ty)
    where getField = fromPtr (Proxy @"unwrapT")
instance HasCField T "unwrapT"
    where type CFieldType T "unwrapT" = S
          offset# = \_ -> \_ -> 0
-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
foreign import ccall safe "hs_bindgen_67465eb5641985dc" hs_bindgen_67465eb5641985dc_base ::
    Ptr Void
 -> Ptr Void
 -> IO Unit
-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
hs_bindgen_67465eb5641985dc :: PtrConst T -> PtrConst T -> IO Unit
-- __unique:__ @test_functionsheap_typesstruct_co_Example_Safe_fun@
hs_bindgen_67465eb5641985dc = fromFFIType hs_bindgen_67465eb5641985dc_base
{-| __C declaration:__ @fun@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
fun :: T -> IO T
{-| __C declaration:__ @fun@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
fun = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_67465eb5641985dc (unsafeFromPtr x_1) res_2))
-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
foreign import ccall unsafe "hs_bindgen_4351e21e32969011" hs_bindgen_4351e21e32969011_base ::
    Ptr Void
 -> Ptr Void
 -> IO Unit
-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
hs_bindgen_4351e21e32969011 :: PtrConst T -> PtrConst T -> IO Unit
-- __unique:__ @test_functionsheap_typesstruct_co_Example_Unsafe_fun@
hs_bindgen_4351e21e32969011 = fromFFIType hs_bindgen_4351e21e32969011_base
{-| __C declaration:__ @fun@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
fun :: T -> IO T
{-| __C declaration:__ @fun@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
fun = \x_0 -> with x_0 (\x_1 -> allocaAndPeek (\res_2 -> hs_bindgen_4351e21e32969011 (unsafeFromPtr x_1) res_2))
-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
foreign import ccall unsafe "hs_bindgen_564814e9ac709cad" hs_bindgen_564814e9ac709cad_base ::
    IO (FunPtr Void)
-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
hs_bindgen_564814e9ac709cad :: IO (FunPtr (T -> IO T))
-- __unique:__ @test_functionsheap_typesstruct_co_Example_get_fun@
hs_bindgen_564814e9ac709cad = fromFFIType hs_bindgen_564814e9ac709cad_base
{-# NOINLINE fun #-}
{-| __C declaration:__ @fun@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
fun :: FunPtr (T -> IO T)
{-| __C declaration:__ @fun@

    __defined at:__ @functions\/heap_types\/struct_const_typedef.h 9:3@

    __exported by:__ @functions\/heap_types\/struct_const_typedef.h@
-}
fun = unsafePerformIO hs_bindgen_564814e9ac709cad
