Buy-in for technical proposal 47 which affect GHC devs

Ben Gamari ben at smart-cactus.org
Sat Mar 25 16:58:32 UTC 2023


Phyx <lonetiger at gmail.com> writes:

>> I highly doubt that this split will have any measurable overhead.
>> Reexporting a definition defined in one module from another module via
>> an export list does not produce any code at all; importing such a
>> declaration is equivalent to importing the definition from the defining
>> module.
>
> Ah right, I can see how that's true at the Haskell level but..
>
>> If for some reason we can't in some cases directly reexport then we
>> would likely rather have a some very trivial bindings that GHC would be
>> quite eager to inline.
>
> Sure, I can see how you'd inline based on the haskell contract, I can't see
> how you avoid the compile time overhead when compiling the library. If you
> have a haskell library
>
> module Test (Control.Monad.when, Control.Applicative.many) where
>
> import Control.Monad(when)
> import Control.Applicative(many)
>
> compiling it:
>
>  ghc test.hs
> [1 of 1] Compiling Test             ( test.hs, test.o )
>
To clarify, what is happening in this program is not inlining. Rather
when you re-export `Control.Monad.when` from `Test` GHC merely records
this fact in the interface file it produces for `Test`. No code is
generated for `when` in `Test`.

Cheers,

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 905 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20230325/351d634e/attachment.sig>


More information about the ghc-devs mailing list