From: simonmar Date: Wed, 4 Dec 2002 12:06:28 +0000 (+0000) Subject: [project @ 2002-12-04 12:06:28 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~1390 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=5af99b7c3ebdda79a181f250b4e61454cb06024d;p=ghc-hetmet.git [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 --- diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index 4cdc3cb..6b3bd13 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -3604,11 +3604,14 @@ hammeredLookup :: Ord key => [(key, value)] -> key -> value {-# SPECIALIZE hammeredLookup :: [(Widget, value)] -> Widget -> value #-} + A SPECIALIZE pragma for a function can + be put anywhere its type signature could be put. + To get very fancy, you can also specify a named function to use for the specialised value, as in: -{-# RULES hammeredLookup = blah #-} +{-# RULES "hammeredLookup" hammeredLookup = blah #-} where blah 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 @@ -3640,9 +3643,6 @@ i2d (I# i) = D# (int2Double# i) -- uses Glasgow prim-op directly Rational—is obscenely expensive by comparison. - A SPECIALIZE pragma for a function can - be put anywhere its type signature could be put. -