Daniel Cartwright
2018-06-08 17:10:08 UTC
The "INLINABLE" pragma's name is misleading, it is more like
"SPECIALISABLE". Consider the documentation for INLINABLE:
Top-level definitions can be marked INLINABLE.
myComplicatedFunction :: (Show a, Num a) => ...
myComplicatedFunction = ...
{-# INLINABLE myComplicatedFunction #-}
This causes exactly two things to happens.
1. The function's (exact) definition is included in the interface file
for the module.
2. The function will be specialised at use sites -- even across modules.
Note that GHC is no more keen to inline an INLINABLE function than any
other.
I propose that we deprecate "INLINABLE" over a number of years at the same
time as introducing "SPECIALISABLE". This wouldn't cause breakages for a
long time.
"SPECIALISABLE". Consider the documentation for INLINABLE:
Top-level definitions can be marked INLINABLE.
myComplicatedFunction :: (Show a, Num a) => ...
myComplicatedFunction = ...
{-# INLINABLE myComplicatedFunction #-}
This causes exactly two things to happens.
1. The function's (exact) definition is included in the interface file
for the module.
2. The function will be specialised at use sites -- even across modules.
Note that GHC is no more keen to inline an INLINABLE function than any
other.
I propose that we deprecate "INLINABLE" over a number of years at the same
time as introducing "SPECIALISABLE". This wouldn't cause breakages for a
long time.