|Copyright||(c) The University of Glasgow 2009|
|Portability||non-portable (GHC Extensions)|
Use GHC.Exts from the base package instead of importing this module directly.
inline f arranges that
f is inlined, regardless of
its size. More precisely, the call
inline f rewrites to the
right-hand side of
f's definition. This allows the programmer to
control inlining from a particular call site rather than the
definition site of the function (c.f.
This inlining occurs regardless of the argument to the call or the
f's definition; it is unconditional. The main caveat is
f's definition must be visible to the compiler; it is
therefore recommended to mark the function with an
pragma at its definition so that GHC guarantees to record its
unfolding regardless of size.
If no inlining takes place, the
inline function expands to the
identity function in Phase zero, so its use imposes no overhead.
lazy function restrains strictness analysis a little. The
lazy e means the same as
lazy has a magical
property so far as strictness analysis is concerned: it is lazy in
its first argument, even though its semantics is strict. After
strictness analysis has run, calls to
lazy are inlined to be the
par :: a -> b -> b par x y = case (par# x) of _ -> lazy y
lazy were not lazy,
par would look strict in
would defeat the whole purpose of
oneShot function can be used to give a hint to the compiler that its
argument will be called at most once, which may (or may not) enable certain
optimizations. It can be useful to improve the performance of code in continuation
oneShot is open kinded, i.e. the type variables can refer to unlifted
types as well.