From 3e0909fc21763bd6558350faf20550d8ce997865 Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 18 Nov 2002 14:35:57 +0000 Subject: [PATCH] [project @ 2002-11-18 14:35:57 by simonpj] A TH fix; and implicit-parameter documentation --- ghc/docs/users_guide/glasgow_exts.sgml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index 7ccd0a6..7dff721 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -1555,7 +1555,7 @@ implicitly parameterized by a comparison function named cmp. The dynamic binding constraints are just a new form of predicate in the type class system. -An implicit parameter occurs in an exprssion using the special form ?x, +An implicit parameter occurs in an expression using the special form ?x, where x is any valid identifier (e.g. ord ?x is a valid expression). Use of this construct also introduces a new @@ -1608,6 +1608,19 @@ Reason: exactly which implicit parameter you pick up depends on exactly where you invoke a function. But the ``invocation'' of instance declarations is done behind the scenes by the compiler, so it's hard to figure out exactly where it is done. Easiest thing is to outlaw the offending types. + +Implicit-parameter constraints do not cause ambiguity. For example, consider: + + f :: (?x :: [a]) => Int -> Int + f n = n + length ?x + + g :: (Read a, Show a) => String -> String + g s = show (read s) + +Here, g has an ambiguous type, and is rejected, but f +is fine. The binding for ?x at f's call site is +quite unambiguous, and fixes the type a. + @@ -3272,12 +3285,6 @@ Tim Sheard is going to expand it.) - If the module contains any top-level splices that must be run, you must use GHC with - --make or --interactive flags. (Reason: that - means it walks the dependency tree and knows what modules must be linked etc.) - - - You can only run a function at compile time if it is imported from another module. That is, you can't define a function in a module, and call it from within a splice in the same module. (It would make sense to do so, but it's hard to implement.) @@ -3288,6 +3295,10 @@ Tim Sheard is going to expand it.) + Template Haskell works in any mode (--make, --interactive, + or file-at-a-time). There used to be a restriction to the former two, but that restriction + has been lifted. + -- 1.7.10.4