Mark pure function
This commit is contained in:
parent
5907a064a7
commit
5019af701f
@ -41,5 +41,5 @@ helloStruct = Raw.hello_struct . convertT
|
||||
helloShape :: Shape -> IO ()
|
||||
helloShape = Raw.hello_shape . convertShape
|
||||
|
||||
add :: Int64 -> Int64 -> IO Int64
|
||||
add :: Int64 -> Int64 -> Int64
|
||||
add = Raw.add
|
||||
|
||||
@ -9,4 +9,4 @@ main = do
|
||||
helloStruct T{a = False, b = maxBound}
|
||||
helloShape $ Circle 3.14
|
||||
helloShape $ Rectangle 10.0 5.0
|
||||
putStrLn . ("3 + 4 = " <>) . show =<< add 3 4
|
||||
putStrLn $ "3 + 4 = " <> show (add 3 4)
|
||||
|
||||
@ -125,7 +125,7 @@ hs_bindgen_bbabdbe61cd1eeb2 =
|
||||
{-# NOINLINE add #-}
|
||||
{-| __C declaration:__ @add@
|
||||
|
||||
__defined at:__ @garnet_rs.h 38:9@
|
||||
__defined at:__ @garnet_rs.h 38:32@
|
||||
|
||||
__exported by:__ @garnet_rs.h@
|
||||
-}
|
||||
|
||||
@ -126,26 +126,30 @@ hello_shape =
|
||||
foreign import ccall safe "hs_bindgen_1c0c71fa74c428a9" hs_bindgen_1c0c71fa74c428a9_base ::
|
||||
GHC.Int.Int64
|
||||
-> GHC.Int.Int64
|
||||
-> IO GHC.Int.Int64
|
||||
-> GHC.Int.Int64
|
||||
|
||||
-- __unique:__ @com_garnet_GarnetRs_Safe_add@
|
||||
hs_bindgen_1c0c71fa74c428a9 ::
|
||||
HsBindgen.Runtime.LibC.Int64
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
-> IO HsBindgen.Runtime.LibC.Int64
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
hs_bindgen_1c0c71fa74c428a9 =
|
||||
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_1c0c71fa74c428a9_base
|
||||
|
||||
{-| __C declaration:__ @add@
|
||||
{-|
|
||||
|
||||
__defined at:__ @garnet_rs.h 38:9@
|
||||
Marked @__attribute((const))__@
|
||||
|
||||
__exported by:__ @garnet_rs.h@
|
||||
__C declaration:__ @add@
|
||||
|
||||
__defined at:__ @garnet_rs.h 38:32@
|
||||
|
||||
__exported by:__ @garnet_rs.h@
|
||||
-}
|
||||
add ::
|
||||
HsBindgen.Runtime.LibC.Int64
|
||||
-- ^ __C declaration:__ @a@
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
-- ^ __C declaration:__ @b@
|
||||
-> IO HsBindgen.Runtime.LibC.Int64
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
add = hs_bindgen_1c0c71fa74c428a9
|
||||
|
||||
@ -126,26 +126,30 @@ hello_shape =
|
||||
foreign import ccall unsafe "hs_bindgen_20eb651f0a8faf48" hs_bindgen_20eb651f0a8faf48_base ::
|
||||
GHC.Int.Int64
|
||||
-> GHC.Int.Int64
|
||||
-> IO GHC.Int.Int64
|
||||
-> GHC.Int.Int64
|
||||
|
||||
-- __unique:__ @com_garnet_GarnetRs_Unsafe_add@
|
||||
hs_bindgen_20eb651f0a8faf48 ::
|
||||
HsBindgen.Runtime.LibC.Int64
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
-> IO HsBindgen.Runtime.LibC.Int64
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
hs_bindgen_20eb651f0a8faf48 =
|
||||
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_20eb651f0a8faf48_base
|
||||
|
||||
{-| __C declaration:__ @add@
|
||||
{-|
|
||||
|
||||
__defined at:__ @garnet_rs.h 38:9@
|
||||
Marked @__attribute((const))__@
|
||||
|
||||
__exported by:__ @garnet_rs.h@
|
||||
__C declaration:__ @add@
|
||||
|
||||
__defined at:__ @garnet_rs.h 38:32@
|
||||
|
||||
__exported by:__ @garnet_rs.h@
|
||||
-}
|
||||
add ::
|
||||
HsBindgen.Runtime.LibC.Int64
|
||||
-- ^ __C declaration:__ @a@
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
-- ^ __C declaration:__ @b@
|
||||
-> IO HsBindgen.Runtime.LibC.Int64
|
||||
-> HsBindgen.Runtime.LibC.Int64
|
||||
add = hs_bindgen_20eb651f0a8faf48
|
||||
|
||||
@ -35,4 +35,4 @@ void hello_struct(struct T t);
|
||||
|
||||
void hello_shape(struct Shape s);
|
||||
|
||||
int64_t add(int64_t a, int64_t b);
|
||||
__attribute__((const)) int64_t add(int64_t a, int64_t b);
|
||||
|
||||
@ -34,6 +34,7 @@ extern "C" fn hello_shape(s: Shape) -> () {
|
||||
say_hello(&format!("{:?}", s))
|
||||
}
|
||||
|
||||
/// cbindgen:prefix=__attribute__((const))
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn add(a: i64, b: i64) -> i64 {
|
||||
a + b
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user