diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-11-15 17:18:02 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-11-15 17:18:02 +0000 |
commit | defcf2a26d1e394e443167853a7988750ad98607 (patch) | |
tree | 84c35cfd2818e4bf262219a7bb41ceab57d1759e /docs | |
parent | 078b891f9d64c70cc72637be9e6a274275244990 (diff) | |
download | haskell-defcf2a26d1e394e443167853a7988750ad98607.tar.gz |
Improve documentation of SPECIALISE pragma
Diffstat (limited to 'docs')
-rwxr-xr-x | docs/users_guide/glasgow_exts.xml | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 6d1b293701..79dda7db09 100755 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -8344,12 +8344,21 @@ happen. </programlisting> <para>A <literal>SPECIALIZE</literal> pragma for a function can - be put anywhere its type signature could be put.</para> + be put anywhere its type signature could be put. Moreover, you + can also <literal>SPECIALIZE</literal> an <emphasis>imported</emphasis> + provided it was given an <literal>INLINABLE</literal> pragma at its definition site + (<xref linkend="inlinable-pragma".>)</para> <para>A <literal>SPECIALIZE</literal> has the effect of generating (a) a specialised version of the function and (b) a rewrite rule - (see <xref linkend="rewrite-rules"/>) that rewrites a call to the - un-specialised function into a call to the specialised one.</para> + (see <xref linkend="rewrite-rules"/>) that rewrites a call to + the un-specialised function into a call to the specialised one. + Moreover, given a <literal>SPECIALIZE</literal> pragma for a + function <literal>f</literal>, GHC will automatically create + specialisations for any type-class-overloaded functions called + by <literal>f</literal>, if they are in the same module as + the <literal>SPECIALIZE</literal> pragma, or if they are + <literal>INLINABLE</literal>; and so on, transitively.</para> <para>The type in a SPECIALIZE pragma can be any type that is less polymorphic than the type of the original function. In concrete terms, |