From 8750d41a6d5b72631782a8a56418d199a0aa4c58 Mon Sep 17 00:00:00 2001 From: simonpj Date: Thu, 27 Jan 2005 10:45:48 +0000 Subject: [PATCH] [project @ 2005-01-27 10:45:47 by simonpj] -------------------------------------------- Replace hi-boot files with hs-boot files -------------------------------------------- This major commit completely re-organises the way that recursive modules are dealt with. * It should have NO EFFECT if you do not use recursive modules * It is a BREAKING CHANGE if you do ====== Warning: .hi-file format has changed, so if you are ====== updating into an existing HEAD build, you'll ====== need to make clean and re-make The details: [documentation still to be done] * Recursive loops are now broken with Foo.hs-boot (or Foo.lhs-boot), not Foo.hi-boot * An hs-boot files is a proper source file. It is compiled just like a regular Haskell source file: ghc Foo.hs generates Foo.hi, Foo.o ghc Foo.hs-boot generates Foo.hi-boot, Foo.o-boot * hs-boot files are precisely a subset of Haskell. In particular: - they have the same import, export, and scoping rules - errors (such as kind errors) in hs-boot files are checked You do *not* need to mention the "original" name of something in an hs-boot file, any more than you do in any other Haskell module. * The Foo.hi-boot file generated by compiling Foo.hs-boot is a machine- generated interface file, in precisely the same format as Foo.hi * When compiling Foo.hs, its exports are checked for compatibility with Foo.hi-boot (previously generated by compiling Foo.hs-boot) * The dependency analyser (ghc -M) knows about Foo.hs-boot files, and generates appropriate dependencies. For regular source files it generates Foo.o : Foo.hs Foo.o : Baz.hi -- Foo.hs imports Baz Foo.o : Bog.hi-boot -- Foo.hs source-imports Bog For a hs-boot file it generates similar dependencies Bog.o-boot : Bog.hs-boot Bog.o-boot : Nib.hi -- Bog.hs-boto imports Nib * ghc -M is also enhanced to use the compilation manager dependency chasing, so that ghc -M Main will usually do the job. No need to enumerate all the source files. * The -c flag is no longer a "compiler mode". It simply means "omit the link step", and synonymous with -no-link. --- Data/{Dynamic.hi-boot => Dynamic.hs-boot} | 1 + Foreign/Ptr.hs | 1 - GHC/Err.hi-boot | 20 -------------------- GHC/Err.lhs-boot | 23 +++++++++++++++++++++++ GHC/Num.lhs | 1 - GHC/Unicode.hi-boot | 14 -------------- GHC/Unicode.hs-boot | 17 +++++++++++++++++ 7 files changed, 41 insertions(+), 36 deletions(-) rename Data/{Dynamic.hi-boot => Dynamic.hs-boot} (50%) delete mode 100644 GHC/Err.hi-boot create mode 100644 GHC/Err.lhs-boot delete mode 100644 GHC/Unicode.hi-boot create mode 100644 GHC/Unicode.hs-boot diff --git a/Data/Dynamic.hi-boot b/Data/Dynamic.hs-boot similarity index 50% rename from Data/Dynamic.hi-boot rename to Data/Dynamic.hs-boot index 7ab9f6a..822ef67 100644 --- a/Data/Dynamic.hi-boot +++ b/Data/Dynamic.hs-boot @@ -1,2 +1,3 @@ +{-# OPTIONS -fno-implicit-prelude #-} module Data.Dynamic where data Dynamic diff --git a/Foreign/Ptr.hs b/Foreign/Ptr.hs index 7ab3c02..ad20da4 100644 --- a/Foreign/Ptr.hs +++ b/Foreign/Ptr.hs @@ -42,7 +42,6 @@ module Foreign.Ptr ( #ifdef __GLASGOW_HASKELL__ import GHC.Ptr import GHC.IOBase -import GHC.Err import GHC.Base import GHC.Num import GHC.List diff --git a/GHC/Err.hi-boot b/GHC/Err.hi-boot deleted file mode 100644 index 4ae901a..0000000 --- a/GHC/Err.hi-boot +++ /dev/null @@ -1,20 +0,0 @@ ---------------------------------------------------------------------------- --- PrelErr.hi-boot --- --- This hand-written interface file is the initial bootstrap version --- for PrelErr.hi. --- It doesn't need to give "error" a type signature, --- because it's wired into the compiler ---------------------------------------------------------------------------- - -module GHC.Err where - --- We can't give an accurate type for error, because it mentions an open --- type variable, but fortunately it doesn't matter what type we --- give here because the compiler will use its wired-in version. But we have --- to mention 'error' so that it gets exported from this .hi-boot --- file. -error :: GHC.Base.String -> a - --- divide by zero is needed quite early -divZeroError :: a diff --git a/GHC/Err.lhs-boot b/GHC/Err.lhs-boot new file mode 100644 index 0000000..70afbb9 --- /dev/null +++ b/GHC/Err.lhs-boot @@ -0,0 +1,23 @@ +\begin{code} +{-# OPTIONS -fno-implicit-prelude #-} +--------------------------------------------------------------------------- +-- Ghc.Err.hs-boot +--------------------------------------------------------------------------- + +module GHC.Err( error, divZeroError ) where + +-- The type signature for 'error' is a gross hack. +-- First, we can't give an accurate type for error, because it mentions +-- an open type variable. +-- Second, we can't even say error :: [Char] -> a, because Char is defined +-- in GHC.Base, and that would make Err.lhs-boot mutually recursive +-- with GHC.Base. +-- Fortunately it doesn't matter what type we give here because the +-- compiler will use its wired-in version. But we have +-- to mention 'error' so that it gets exported from this .hi-boot +-- file. +error :: a + +-- divide by zero is needed quite early +divZeroError :: a +\end{code} diff --git a/GHC/Num.lhs b/GHC/Num.lhs index 5d55946..76d6c8b 100644 --- a/GHC/Num.lhs +++ b/GHC/Num.lhs @@ -27,7 +27,6 @@ module GHC.Num where import {-# SOURCE #-} GHC.Err import GHC.Base -import GHC.List import GHC.Enum import GHC.Show diff --git a/GHC/Unicode.hi-boot b/GHC/Unicode.hi-boot deleted file mode 100644 index 43204df..0000000 --- a/GHC/Unicode.hi-boot +++ /dev/null @@ -1,14 +0,0 @@ -module GHC.Unicode where - -isAscii :: GHC.Base.Char -> GHC.Base.Bool -isLatin1 :: GHC.Base.Char -> GHC.Base.Bool -isControl :: GHC.Base.Char -> GHC.Base.Bool -isPrint :: GHC.Base.Char -> GHC.Base.Bool -isSpace :: GHC.Base.Char -> GHC.Base.Bool -isUpper :: GHC.Base.Char -> GHC.Base.Bool -isLower :: GHC.Base.Char -> GHC.Base.Bool -isAlpha :: GHC.Base.Char -> GHC.Base.Bool -isDigit :: GHC.Base.Char -> GHC.Base.Bool -isOctDigit :: GHC.Base.Char -> GHC.Base.Bool -isHexDigit :: GHC.Base.Char -> GHC.Base.Bool -isAlphaNum :: GHC.Base.Char -> GHC.Base.Bool diff --git a/GHC/Unicode.hs-boot b/GHC/Unicode.hs-boot new file mode 100644 index 0000000..1690110 --- /dev/null +++ b/GHC/Unicode.hs-boot @@ -0,0 +1,17 @@ +{-# OPTIONS -fno-implicit-prelude #-} + +module GHC.Unicode where +import GHC.Base( Char, Bool ) + +isAscii :: Char -> Bool +isLatin1 :: Char -> Bool +isControl :: Char -> Bool +isPrint :: Char -> Bool +isSpace :: Char -> Bool +isUpper :: Char -> Bool +isLower :: Char -> Bool +isAlpha :: Char -> Bool +isDigit :: Char -> Bool +isOctDigit :: Char -> Bool +isHexDigit :: Char -> Bool +isAlphaNum :: Char -> Bool -- 1.7.10.4