2026-02-19 11:08:20 +00:00
|
|
|
{-# LANGUAGE CApiFFI #-}
|
|
|
|
|
{-# LANGUAGE NoImplicitPrelude #-}
|
|
|
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
|
{-# OPTIONS_HADDOCK prune #-}
|
|
|
|
|
|
|
|
|
|
module GarnetRs.Unsafe where
|
|
|
|
|
|
2026-02-19 11:15:38 +00:00
|
|
|
import qualified Foreign as F
|
2026-02-19 11:08:20 +00:00
|
|
|
import qualified Foreign.C as FC
|
2026-02-19 15:26:27 +00:00
|
|
|
import qualified GHC.Int
|
2026-02-19 11:08:20 +00:00
|
|
|
import qualified GHC.Ptr as Ptr
|
|
|
|
|
import qualified HsBindgen.Runtime.Internal.CAPI
|
|
|
|
|
import qualified HsBindgen.Runtime.Internal.HasFFIType
|
2026-02-19 15:26:27 +00:00
|
|
|
import qualified HsBindgen.Runtime.LibC
|
2026-02-19 11:08:20 +00:00
|
|
|
import qualified HsBindgen.Runtime.PtrConst
|
|
|
|
|
import Data.Void (Void)
|
2026-02-19 11:11:23 +00:00
|
|
|
import GarnetRs
|
2026-02-19 11:08:20 +00:00
|
|
|
import Prelude (IO)
|
|
|
|
|
|
|
|
|
|
$(HsBindgen.Runtime.Internal.CAPI.addCSource (HsBindgen.Runtime.Internal.CAPI.unlines
|
|
|
|
|
[ "#include <garnet_rs.h>"
|
|
|
|
|
, "void hs_bindgen_2dfe97662a4d6377 ("
|
|
|
|
|
, " char const *arg1"
|
|
|
|
|
, ")"
|
|
|
|
|
, "{"
|
|
|
|
|
, " hello(arg1);"
|
|
|
|
|
, "}"
|
2026-02-19 11:11:23 +00:00
|
|
|
, "void hs_bindgen_29d823ada2bc7302 ("
|
2026-02-19 11:15:38 +00:00
|
|
|
, " struct T *arg1"
|
2026-02-19 11:11:23 +00:00
|
|
|
, ")"
|
|
|
|
|
, "{"
|
2026-02-19 11:15:38 +00:00
|
|
|
, " hello_struct(*arg1);"
|
2026-02-19 11:11:23 +00:00
|
|
|
, "}"
|
|
|
|
|
, "void hs_bindgen_b3f40a03f07eaa85 ("
|
2026-02-19 11:15:38 +00:00
|
|
|
, " struct Shape *arg1"
|
2026-02-19 11:11:23 +00:00
|
|
|
, ")"
|
|
|
|
|
, "{"
|
2026-02-19 11:15:38 +00:00
|
|
|
, " hello_shape(*arg1);"
|
2026-02-19 11:11:23 +00:00
|
|
|
, "}"
|
2026-02-19 15:47:55 +00:00
|
|
|
, "int64_t hs_bindgen_20eb651f0a8faf48 ("
|
|
|
|
|
, " int64_t arg1,"
|
|
|
|
|
, " int64_t arg2"
|
2026-02-19 15:26:27 +00:00
|
|
|
, ")"
|
|
|
|
|
, "{"
|
|
|
|
|
, " return add(arg1, arg2);"
|
|
|
|
|
, "}"
|
2026-02-19 20:44:04 +00:00
|
|
|
, "int64_t hs_bindgen_c2ced4f3ba39c8ff ("
|
2026-02-19 21:11:58 +00:00
|
|
|
, " struct BTreeC *arg1"
|
2026-02-19 20:44:04 +00:00
|
|
|
, ")"
|
|
|
|
|
, "{"
|
|
|
|
|
, " return sum_tree(*arg1);"
|
|
|
|
|
, "}"
|
2026-02-19 11:08:20 +00:00
|
|
|
]))
|
|
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_hello@
|
|
|
|
|
foreign import ccall unsafe "hs_bindgen_2dfe97662a4d6377" hs_bindgen_2dfe97662a4d6377_base ::
|
|
|
|
|
Ptr.Ptr Void
|
|
|
|
|
-> IO ()
|
|
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_hello@
|
|
|
|
|
hs_bindgen_2dfe97662a4d6377 ::
|
|
|
|
|
HsBindgen.Runtime.PtrConst.PtrConst FC.CChar
|
|
|
|
|
-> IO ()
|
|
|
|
|
hs_bindgen_2dfe97662a4d6377 =
|
|
|
|
|
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_2dfe97662a4d6377_base
|
|
|
|
|
|
|
|
|
|
{-| __C declaration:__ @hello@
|
|
|
|
|
|
2026-02-19 20:44:04 +00:00
|
|
|
__defined at:__ @garnet_rs.h 55:6@
|
2026-02-19 11:08:20 +00:00
|
|
|
|
|
|
|
|
__exported by:__ @garnet_rs.h@
|
|
|
|
|
-}
|
|
|
|
|
hello ::
|
|
|
|
|
HsBindgen.Runtime.PtrConst.PtrConst FC.CChar
|
|
|
|
|
-- ^ __C declaration:__ @c@
|
|
|
|
|
-> IO ()
|
|
|
|
|
hello = hs_bindgen_2dfe97662a4d6377
|
2026-02-19 11:11:23 +00:00
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_hello_struct@
|
|
|
|
|
foreign import ccall unsafe "hs_bindgen_29d823ada2bc7302" hs_bindgen_29d823ada2bc7302_base ::
|
|
|
|
|
Ptr.Ptr Void
|
|
|
|
|
-> IO ()
|
|
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_hello_struct@
|
|
|
|
|
hs_bindgen_29d823ada2bc7302 ::
|
2026-02-19 11:15:38 +00:00
|
|
|
Ptr.Ptr T
|
2026-02-19 11:11:23 +00:00
|
|
|
-> IO ()
|
|
|
|
|
hs_bindgen_29d823ada2bc7302 =
|
|
|
|
|
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_29d823ada2bc7302_base
|
|
|
|
|
|
|
|
|
|
{-| __C declaration:__ @hello_struct@
|
|
|
|
|
|
2026-02-19 20:44:04 +00:00
|
|
|
__defined at:__ @garnet_rs.h 57:6@
|
2026-02-19 11:11:23 +00:00
|
|
|
|
|
|
|
|
__exported by:__ @garnet_rs.h@
|
|
|
|
|
-}
|
|
|
|
|
hello_struct ::
|
2026-02-19 11:15:38 +00:00
|
|
|
T
|
2026-02-19 11:11:23 +00:00
|
|
|
-- ^ __C declaration:__ @t@
|
|
|
|
|
-> IO ()
|
2026-02-19 11:15:38 +00:00
|
|
|
hello_struct =
|
|
|
|
|
\t0 ->
|
|
|
|
|
F.with t0 (\t1 -> hs_bindgen_29d823ada2bc7302 t1)
|
2026-02-19 11:11:23 +00:00
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_hello_shape@
|
|
|
|
|
foreign import ccall unsafe "hs_bindgen_b3f40a03f07eaa85" hs_bindgen_b3f40a03f07eaa85_base ::
|
|
|
|
|
Ptr.Ptr Void
|
|
|
|
|
-> IO ()
|
|
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_hello_shape@
|
|
|
|
|
hs_bindgen_b3f40a03f07eaa85 ::
|
2026-02-19 11:15:38 +00:00
|
|
|
Ptr.Ptr Shape
|
2026-02-19 11:11:23 +00:00
|
|
|
-> IO ()
|
|
|
|
|
hs_bindgen_b3f40a03f07eaa85 =
|
|
|
|
|
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_b3f40a03f07eaa85_base
|
|
|
|
|
|
|
|
|
|
{-| __C declaration:__ @hello_shape@
|
|
|
|
|
|
2026-02-19 20:44:04 +00:00
|
|
|
__defined at:__ @garnet_rs.h 59:6@
|
2026-02-19 11:11:23 +00:00
|
|
|
|
|
|
|
|
__exported by:__ @garnet_rs.h@
|
|
|
|
|
-}
|
|
|
|
|
hello_shape ::
|
2026-02-19 11:15:38 +00:00
|
|
|
Shape
|
2026-02-19 11:11:23 +00:00
|
|
|
-- ^ __C declaration:__ @s@
|
|
|
|
|
-> IO ()
|
2026-02-19 11:15:38 +00:00
|
|
|
hello_shape =
|
|
|
|
|
\s0 ->
|
|
|
|
|
F.with s0 (\s1 -> hs_bindgen_b3f40a03f07eaa85 s1)
|
2026-02-19 15:26:27 +00:00
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_add@
|
|
|
|
|
foreign import ccall unsafe "hs_bindgen_20eb651f0a8faf48" hs_bindgen_20eb651f0a8faf48_base ::
|
|
|
|
|
GHC.Int.Int64
|
|
|
|
|
-> GHC.Int.Int64
|
2026-02-19 15:56:55 +00:00
|
|
|
-> GHC.Int.Int64
|
2026-02-19 15:26:27 +00:00
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_add@
|
|
|
|
|
hs_bindgen_20eb651f0a8faf48 ::
|
2026-02-19 15:47:55 +00:00
|
|
|
HsBindgen.Runtime.LibC.Int64
|
|
|
|
|
-> HsBindgen.Runtime.LibC.Int64
|
2026-02-19 15:56:55 +00:00
|
|
|
-> HsBindgen.Runtime.LibC.Int64
|
2026-02-19 15:26:27 +00:00
|
|
|
hs_bindgen_20eb651f0a8faf48 =
|
|
|
|
|
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_20eb651f0a8faf48_base
|
|
|
|
|
|
2026-02-19 15:56:55 +00:00
|
|
|
{-|
|
2026-02-19 15:26:27 +00:00
|
|
|
|
2026-02-19 15:56:55 +00:00
|
|
|
Marked @__attribute((const))__@
|
2026-02-19 15:26:27 +00:00
|
|
|
|
2026-02-19 15:56:55 +00:00
|
|
|
__C declaration:__ @add@
|
|
|
|
|
|
2026-02-19 20:44:04 +00:00
|
|
|
__defined at:__ @garnet_rs.h 61:32@
|
2026-02-19 15:56:55 +00:00
|
|
|
|
|
|
|
|
__exported by:__ @garnet_rs.h@
|
2026-02-19 15:26:27 +00:00
|
|
|
-}
|
|
|
|
|
add ::
|
2026-02-19 15:47:55 +00:00
|
|
|
HsBindgen.Runtime.LibC.Int64
|
2026-02-19 15:26:27 +00:00
|
|
|
-- ^ __C declaration:__ @a@
|
2026-02-19 15:47:55 +00:00
|
|
|
-> HsBindgen.Runtime.LibC.Int64
|
2026-02-19 15:26:27 +00:00
|
|
|
-- ^ __C declaration:__ @b@
|
2026-02-19 15:56:55 +00:00
|
|
|
-> HsBindgen.Runtime.LibC.Int64
|
2026-02-19 15:26:27 +00:00
|
|
|
add = hs_bindgen_20eb651f0a8faf48
|
2026-02-19 20:44:04 +00:00
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_sum_tree@
|
|
|
|
|
foreign import ccall unsafe "hs_bindgen_c2ced4f3ba39c8ff" hs_bindgen_c2ced4f3ba39c8ff_base ::
|
|
|
|
|
Ptr.Ptr Void
|
|
|
|
|
-> IO GHC.Int.Int64
|
|
|
|
|
|
|
|
|
|
-- __unique:__ @com_garnet_GarnetRs_Unsafe_sum_tree@
|
|
|
|
|
hs_bindgen_c2ced4f3ba39c8ff ::
|
2026-02-19 21:11:58 +00:00
|
|
|
Ptr.Ptr BTreeC
|
2026-02-19 20:44:04 +00:00
|
|
|
-> IO HsBindgen.Runtime.LibC.Int64
|
|
|
|
|
hs_bindgen_c2ced4f3ba39c8ff =
|
|
|
|
|
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_c2ced4f3ba39c8ff_base
|
|
|
|
|
|
|
|
|
|
{-| __C declaration:__ @sum_tree@
|
|
|
|
|
|
|
|
|
|
__defined at:__ @garnet_rs.h 63:9@
|
|
|
|
|
|
|
|
|
|
__exported by:__ @garnet_rs.h@
|
|
|
|
|
-}
|
|
|
|
|
sum_tree ::
|
2026-02-19 21:11:58 +00:00
|
|
|
BTreeC
|
2026-02-19 20:44:04 +00:00
|
|
|
-- ^ __C declaration:__ @t@
|
|
|
|
|
-> IO HsBindgen.Runtime.LibC.Int64
|
|
|
|
|
sum_tree =
|
|
|
|
|
\t0 ->
|
|
|
|
|
F.with t0 (\t1 -> hs_bindgen_c2ced4f3ba39c8ff t1)
|