From 5af99b7c3ebdda79a181f250b4e61454cb06024d Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 4 Dec 2002 12:06:28 +0000 Subject: [PATCH] [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 --- ghc/docs/users_guide/glasgow_exts.sgml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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. - -- 1.7.10.4