From 1fb4b05b4e8e7e744a62595af6669af1a57c8779 Mon Sep 17 00:00:00 2001 From: simonpj Date: Tue, 26 Sep 2000 15:58:25 +0000 Subject: [PATCH] [project @ 2000-09-26 15:58:25 by simonpj] Document the new behaviour of -fno-implicit-prelude. (I havn't checked that the new document builds right because my build tree doesn't seem to build documentation. Reuben, could you check, please.) --- ghc/docs/users_guide/using.sgml | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/ghc/docs/users_guide/using.sgml b/ghc/docs/users_guide/using.sgml index 5423f04..0f4f049 100644 --- a/ghc/docs/users_guide/using.sgml +++ b/ghc/docs/users_guide/using.sgml @@ -889,9 +889,35 @@ resets the “import directories” list back to nothing. -fno-implicit-prelude option GHC normally imports Prelude.hi files for you. If you'd rather it -didn't, then give it a option. You are -unlikely to get very far without a Prelude, but, hey, it's a free -country. +didn't, then give it a option. +The idea is that you can then import a Prelude of your own. (But don't call it Prelude; +the Haskell module namespace is flat, and you must not conflict with any Prelude module.) + + +Even though you have not imported the Prelude, all the built-in syntax still refers to +the built-in Haskell Prelude types and values, as specified by the Haskell Report. +For example, the type [Int] +still means Prelude.[] Int; tuples continue to refer to the standard Prelude +tuples; the translation for list comprehensions continues to use Prelude.map etc. + + With one group of exceptions! You may want to define your own numeric class hierarchy. +It completely defeats that purpose if the literal "1" means "Prelude.fromInteger 1", +which is what the Haskell Report specifies. So the flag causes +the following pieces of built-in syntax to refer to whatever is in scope, not the Prelude versions: + + +Integer and fractional literals mean "fromInteger 1" and "fromRational 3.2", +not the Prelude-qualified versions; both in expressions and in patterns. + + +Negation (e.g. "- (f x)") means "negate (f x)" (not Prelude.negate). + + +In an n+k pattern, the standard Prelude OrdK/Literal> class is used for comparison, but the +necessary subtraction uses +whatever "(-)" is in scope (not "Prelude.(-)"). + + -- 1.7.10.4