[Haskell-cafe] Does an unboxed unit get pushed to the stack?

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Thu Jan 12 13:12:21 UTC 2023


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?
    
Thanks,

Tom


    {-# LANGUAGE MagicHash #-}
    {-# LANGUAGE UnboxedTuples #-}
    
    module Bar where
    
    import GHC.Prim
    
    foo :: Int
    foo = 1

    bar :: (# #) -> Int
    bar (# #) = 1
    
    baz :: () -> Int
    baz () = 0


More information about the Haskell-Cafe mailing list