Commit 5af99b7c authored by simonmar's avatar simonmar

[project @ 2002-12-04 12:06:28 by simonmar]

Fix SPECIALISE documentation to not mention outdated syntax, and fix
the RULES syntax in one place
parent 89c285c4
......@@ -3604,11 +3604,14 @@ hammeredLookup :: Ord key => [(key, value)] -> key -> value
{-# SPECIALIZE hammeredLookup :: [(Widget, value)] -> Widget -> value #-}
</programlisting>
<para>A <literal>SPECIALIZE</literal> pragma for a function can
be put anywhere its type signature could be put.</para>
<para>To get very fancy, you can also specify a named function
to use for the specialised value, as in:</para>
<programlisting>
{-# RULES hammeredLookup = blah #-}
{-# RULES "hammeredLookup" hammeredLookup = blah #-}
</programlisting>
<para>where <literal>blah</literal> is an implementation of
......@@ -3631,7 +3634,7 @@ hammeredLookup :: Ord key => [(key, value)] -> key -> value
toDouble :: Real a => a -> Double
toDouble = fromRational . toRational
{-# SPECIALIZE toDouble :: Int -> Double = i2d #-}
{-# RULES "toDouble/Int" toDouble = i2d #-}
i2d (I# i) = D# (int2Double# i) -- uses Glasgow prim-op directly
</programlisting>
......@@ -3640,9 +3643,6 @@ i2d (I# i) = D# (int2Double# i) -- uses Glasgow prim-op directly
<literal>Rational</literal>&mdash;is obscenely expensive by
comparison.</para>
<para>A <literal>SPECIALIZE</literal> pragma for a function can
be put anywhere its type signature could be put.</para>
</sect2>
<sect2 id="specialize-instance-pragma">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment