
12 Jan
2023
12 Jan
'23
3:05 p.m.
On Thu, Jan 12, 2023 at 04:01:48PM +0100, Bertram Felgenhauer via Haskell-Cafe wrote:
Tom Ellis wrote:
If I define bar and baz as below then, as I understand it, calling baz requires pushing an argument onto the machine stack. Is the same true for baz, or is "calling" baz the same as "calling" foo, i.e. no argument needs to be pushed?
{-# LANGUAGE MagicHash #-} {-# LANGUAGE UnboxedTuples #-}
module Bar where
import GHC.Prim
foo :: Int foo = 1
bar :: (# #) -> Int bar (# #) = 1
baz :: () -> Int baz () = 0
There is more to the story than just arguments. Assuming that nothing gets inlined
Very helpful, thank you!