diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-05-16 15:21:34 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-05-16 16:22:05 +0200 |
commit | eed820b672e6c3d23106cd151b1e31ce29326e32 (patch) | |
tree | 48fd270edef8f7a50ef28f876b0d5e6a47e6313c | |
parent | d78faa135921dfe7a6b92f908171af1a2cdce512 (diff) | |
download | haskell-eed820b672e6c3d23106cd151b1e31ce29326e32.tar.gz |
Move Extension type to ghc-boot-th
This creates a new package, `ghc-boot-th`, to contain the `Extension`
type, which now lives in `GHC.LanguageExtension.Type`. This ensures that
the transitive dependency set of the `template-haskell` package remains
minimal.
The `GHC.LanguageExtensions.Type` module is also re-exported by
`ghc-boot`, which provides an orphan `binary` instance as well.
Test Plan: Validate
Reviewers: goldfire, thomie, hvr, austin
Reviewed By: thomie
Subscribers: RyanGlScott, thomie, erikd, ezyang
Differential Revision: https://phabricator.haskell.org/D2224
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | compiler/main/DynFlags.hs | 4 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | ghc.mk | 3 | ||||
-rw-r--r-- | libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs | 132 | ||||
-rw-r--r-- | libraries/ghc-boot-th/GHC/Lexeme.hs (renamed from libraries/ghc-boot/GHC/Lexeme.hs) | 0 | ||||
-rw-r--r-- | libraries/ghc-boot-th/LICENSE | 31 | ||||
-rw-r--r-- | libraries/ghc-boot-th/changelog.md | 5 | ||||
-rw-r--r-- | libraries/ghc-boot-th/ghc-boot-th.cabal.in | 37 | ||||
-rw-r--r-- | libraries/ghc-boot/GHC/LanguageExtensions.hs | 135 | ||||
-rw-r--r-- | libraries/ghc-boot/changelog.md | 2 | ||||
-rw-r--r-- | libraries/ghc-boot/ghc-boot.cabal.in | 13 | ||||
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/LanguageExtensions.hs | 2 | ||||
-rw-r--r-- | libraries/template-haskell/template-haskell.cabal | 6 | ||||
-rw-r--r-- | testsuite/tests/th/TH_Roles2.stderr | 7 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 3 |
16 files changed, 242 insertions, 143 deletions
diff --git a/.gitignore b/.gitignore index bc95f12aec..ff87375adc 100644 --- a/.gitignore +++ b/.gitignore @@ -129,6 +129,9 @@ _darcs/ /libraries/ghc-boot/GNUmakefile /libraries/ghc-boot/ghc-boot.cabal /libraries/ghc-boot/ghc.mk +/libraries/ghc-boot-th/GNUmakefile +/libraries/ghc-boot-th/ghc-boot-th.cabal +/libraries/ghc-boot-th/ghc.mk /libraries/ghci/ghci.cabal /libraries/ghci/ghc.mk /libraries/haddock-util.js diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 00a25cd6d9..666748a813 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -240,8 +240,8 @@ import qualified GHC.LanguageExtensions as LangExt -- -- * Adding the extension to GHC.LanguageExtensions -- --- The Extension type in libraries/ghc-boot/GHC/LanguageExtensions.hs is --- the canonical list of language extensions known by GHC. +-- The Extension type in libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs +-- is the canonical list of language extensions known by GHC. -- -- * Adding a flag to DynFlags.xFlags -- diff --git a/configure.ac b/configure.ac index defc1827ac..ff0dc054af 100644 --- a/configure.ac +++ b/configure.ac @@ -1127,7 +1127,7 @@ checkMake380() { checkMake380 make checkMake380 gmake -AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghci/ghci.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac]) +AC_CONFIG_FILES([mk/config.mk mk/install.mk mk/project.mk compiler/ghc.cabal ghc/ghc-bin.cabal utils/runghc/runghc.cabal libraries/ghc-boot/ghc-boot.cabal libraries/ghc-boot-th/ghc-boot-th.cabal libraries/ghci/ghci.cabal settings docs/users_guide/ghc_config.py docs/index.html libraries/prologue.txt distrib/configure.ac]) AC_OUTPUT if test "$print_make_warning" = "true"; then @@ -430,7 +430,7 @@ else # CLEANING # programs such as GHC and ghc-pkg, that we do not assume the stage0 # compiler already has installed (or up-to-date enough). -PACKAGES_STAGE0 = binary Cabal/Cabal hpc ghc-boot hoopl transformers template-haskell +PACKAGES_STAGE0 = binary Cabal/Cabal hpc ghc-boot-th ghc-boot hoopl transformers template-haskell ifeq "$(Windows_Host)" "NO" ifneq "$(HostOS_CPP)" "ios" PACKAGES_STAGE0 += terminfo @@ -460,6 +460,7 @@ PACKAGES_STAGE1 += hpc PACKAGES_STAGE1 += pretty PACKAGES_STAGE1 += binary PACKAGES_STAGE1 += Cabal/Cabal +PACKAGES_STAGE1 += ghc-boot-th PACKAGES_STAGE1 += ghc-boot PACKAGES_STAGE1 += template-haskell PACKAGES_STAGE1 += hoopl diff --git a/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs new file mode 100644 index 0000000000..39613b0c4b --- /dev/null +++ b/libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs @@ -0,0 +1,132 @@ +----------------------------------------------------------------------------- +-- | +-- Module : GHC.LanguageExtensions.Type +-- Copyright : (c) The GHC Team +-- +-- Maintainer : ghc-devs@haskell.org +-- Portability : portable +-- +-- A data type defining the language extensions supported by GHC. +-- +{-# LANGUAGE DeriveGeneric #-} +module GHC.LanguageExtensions.Type ( Extension(..) ) where + +import GHC.Generics + +-- | The language extensions known to GHC. +-- +-- Note that there is an orphan 'Binary' instance for this type supplied by +-- the "GHC.LanguageExtensions" module provided by @ghc-boot@. We can't provide +-- here as this would require adding transitive dependencies to the +-- @template-haskell@ package, which must have a minimal dependency set. +data Extension +-- See Note [Updating flag description in the User's Guide] in DynFlags + = Cpp + | OverlappingInstances + | UndecidableInstances + | IncoherentInstances + | UndecidableSuperClasses + | MonomorphismRestriction + | MonoPatBinds + | MonoLocalBinds + | RelaxedPolyRec -- Deprecated + | ExtendedDefaultRules -- Use GHC's extended rules for defaulting + | ForeignFunctionInterface + | UnliftedFFITypes + | InterruptibleFFI + | CApiFFI + | GHCForeignImportPrim + | JavaScriptFFI + | ParallelArrays -- Syntactic support for parallel arrays + | Arrows -- Arrow-notation syntax + | TemplateHaskell + | TemplateHaskellQuotes -- subset of TH supported by stage1, no splice + | QuasiQuotes + | ImplicitParams + | ImplicitPrelude + | ScopedTypeVariables + | AllowAmbiguousTypes + | UnboxedTuples + | BangPatterns + | TypeFamilies + | TypeFamilyDependencies + | TypeInType + | OverloadedStrings + | OverloadedLists + | NumDecimals + | DisambiguateRecordFields + | RecordWildCards + | RecordPuns + | ViewPatterns + | GADTs + | GADTSyntax + | NPlusKPatterns + | DoAndIfThenElse + | RebindableSyntax + | ConstraintKinds + | PolyKinds -- Kind polymorphism + | DataKinds -- Datatype promotion + | InstanceSigs + | ApplicativeDo + + | StandaloneDeriving + | DeriveDataTypeable + | AutoDeriveTypeable -- Automatic derivation of Typeable + | DeriveFunctor + | DeriveTraversable + | DeriveFoldable + | DeriveGeneric -- Allow deriving Generic/1 + | DefaultSignatures -- Allow extra signatures for defmeths + | DeriveAnyClass -- Allow deriving any class + | DeriveLift -- Allow deriving Lift + + | TypeSynonymInstances + | FlexibleContexts + | FlexibleInstances + | ConstrainedClassMethods + | MultiParamTypeClasses + | NullaryTypeClasses + | FunctionalDependencies + | UnicodeSyntax + | ExistentialQuantification + | MagicHash + | EmptyDataDecls + | KindSignatures + | RoleAnnotations + | ParallelListComp + | TransformListComp + | MonadComprehensions + | GeneralizedNewtypeDeriving + | RecursiveDo + | PostfixOperators + | TupleSections + | PatternGuards + | LiberalTypeSynonyms + | RankNTypes + | ImpredicativeTypes + | TypeOperators + | ExplicitNamespaces + | PackageImports + | ExplicitForAll + | AlternativeLayoutRule + | AlternativeLayoutRuleTransitional + | DatatypeContexts + | NondecreasingIndentation + | RelaxedLayout + | TraditionalRecordSyntax + | LambdaCase + | MultiWayIf + | BinaryLiterals + | NegativeLiterals + | DuplicateRecordFields + | OverloadedLabels + | EmptyCase + | PatternSynonyms + | PartialTypeSignatures + | NamedWildCards + | StaticPointers + | TypeApplications + | Strict + | StrictData + | MonadFailDesugaring + deriving (Eq, Enum, Show, Generic) diff --git a/libraries/ghc-boot/GHC/Lexeme.hs b/libraries/ghc-boot-th/GHC/Lexeme.hs index 677c9a65e6..677c9a65e6 100644 --- a/libraries/ghc-boot/GHC/Lexeme.hs +++ b/libraries/ghc-boot-th/GHC/Lexeme.hs diff --git a/libraries/ghc-boot-th/LICENSE b/libraries/ghc-boot-th/LICENSE new file mode 100644 index 0000000000..b5059b71f6 --- /dev/null +++ b/libraries/ghc-boot-th/LICENSE @@ -0,0 +1,31 @@ +The Glasgow Haskell Compiler License + +Copyright 2002, The University Court of the University of Glasgow. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +- Neither name of the University nor the names of its contributors may be +used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY COURT OF THE UNIVERSITY OF +GLASGOW AND THE CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +UNIVERSITY COURT OF THE UNIVERSITY OF GLASGOW OR THE CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. diff --git a/libraries/ghc-boot-th/changelog.md b/libraries/ghc-boot-th/changelog.md new file mode 100644 index 0000000000..3ed5bbbfd2 --- /dev/null +++ b/libraries/ghc-boot-th/changelog.md @@ -0,0 +1,5 @@ +## 8.0.1 *May 2016* + + * Bundled with GHC 8.0.1 + + * Initial version diff --git a/libraries/ghc-boot-th/ghc-boot-th.cabal.in b/libraries/ghc-boot-th/ghc-boot-th.cabal.in new file mode 100644 index 0000000000..3aebfbfc89 --- /dev/null +++ b/libraries/ghc-boot-th/ghc-boot-th.cabal.in @@ -0,0 +1,37 @@ +-- WARNING: ghc-boot-th.cabal is automatically generated from +-- ghc-boot-th.cabal.in by ../../configure. Make sure you are editing +-- ghc-boot-th.cabal.in, not ghc-boot-th.cabal. + +name: ghc-boot-th +version: @ProjectVersionMunged@ +license: BSD3 +license-file: LICENSE +category: GHC +maintainer: ghc-devs@haskell.org +bug-reports: https://ghc.haskell.org/trac/ghc/newticket +synopsis: Shared functionality between GHC and the @template-haskell@ + library +description: This library contains various bits shared between the @ghc@ and + @template-haskell@ libraries. + . + This package exists to ensure that @template-haskell@ has a + minimal set of transitive dependencies, since it is intended to + be depended upon by user code. +cabal-version: >=1.10 +build-type: Simple +extra-source-files: changelog.md + +source-repository head + type: git + location: http://git.haskell.org/ghc.git + subdir: libraries/ghc-boot-th + +Library + default-language: Haskell2010 + other-extensions: DeriveGeneric + + exposed-modules: + GHC.LanguageExtensions.Type + GHC.Lexeme + + build-depends: base >= 4.7 && < 4.10 diff --git a/libraries/ghc-boot/GHC/LanguageExtensions.hs b/libraries/ghc-boot/GHC/LanguageExtensions.hs index 7add46e194..13c3ec5208 100644 --- a/libraries/ghc-boot/GHC/LanguageExtensions.hs +++ b/libraries/ghc-boot/GHC/LanguageExtensions.hs @@ -1,130 +1,17 @@ ------------------------------------------------------------------------------ --- | --- Module : GHC.LanguageExtensions --- Copyright : (c) The GHC Team --- --- Maintainer : ghc-devs@haskell.org --- Portability : portable +{-# OPTIONS_GHC -fno-warn-orphans #-} + +-- | This module re-exports the 'Extension' type along with an orphan 'Binary' +-- instance for it. -- --- A data type defining the language extensions supported by GHC. +-- Note that the @ghc-boot@ package has a large set of dependencies; for this +-- reason the 'Extension' type itself is defined in the +-- "GHC.LanguageExtensions.Type" module provided by the @ghc-boot-th@ package, +-- which has no dependencies outside of @base@. For this reason +-- @template-haskell@ depends upon @ghc-boot-th@, not @ghc-boot@. -- -{-# LANGUAGE DeriveGeneric #-} -module GHC.LanguageExtensions ( Extension(..) ) where +module GHC.LanguageExtensions ( module GHC.LanguageExtensions.Type ) where -import GHC.Generics import Data.Binary - --- | The language extensions known to GHC. -data Extension --- See Note [Updating flag description in the User's Guide] in DynFlags - = Cpp - | OverlappingInstances - | UndecidableInstances - | IncoherentInstances - | UndecidableSuperClasses - | MonomorphismRestriction - | MonoPatBinds - | MonoLocalBinds - | RelaxedPolyRec -- Deprecated - | ExtendedDefaultRules -- Use GHC's extended rules for defaulting - | ForeignFunctionInterface - | UnliftedFFITypes - | InterruptibleFFI - | CApiFFI - | GHCForeignImportPrim - | JavaScriptFFI - | ParallelArrays -- Syntactic support for parallel arrays - | Arrows -- Arrow-notation syntax - | TemplateHaskell - | TemplateHaskellQuotes -- subset of TH supported by stage1, no splice - | QuasiQuotes - | ImplicitParams - | ImplicitPrelude - | ScopedTypeVariables - | AllowAmbiguousTypes - | UnboxedTuples - | BangPatterns - | TypeFamilies - | TypeFamilyDependencies - | TypeInType - | OverloadedStrings - | OverloadedLists - | NumDecimals - | DisambiguateRecordFields - | RecordWildCards - | RecordPuns - | ViewPatterns - | GADTs - | GADTSyntax - | NPlusKPatterns - | DoAndIfThenElse - | RebindableSyntax - | ConstraintKinds - | PolyKinds -- Kind polymorphism - | DataKinds -- Datatype promotion - | InstanceSigs - | ApplicativeDo - - | StandaloneDeriving - | DeriveDataTypeable - | AutoDeriveTypeable -- Automatic derivation of Typeable - | DeriveFunctor - | DeriveTraversable - | DeriveFoldable - | DeriveGeneric -- Allow deriving Generic/1 - | DefaultSignatures -- Allow extra signatures for defmeths - | DeriveAnyClass -- Allow deriving any class - | DeriveLift -- Allow deriving Lift - - | TypeSynonymInstances - | FlexibleContexts - | FlexibleInstances - | ConstrainedClassMethods - | MultiParamTypeClasses - | NullaryTypeClasses - | FunctionalDependencies - | UnicodeSyntax - | ExistentialQuantification - | MagicHash - | EmptyDataDecls - | KindSignatures - | RoleAnnotations - | ParallelListComp - | TransformListComp - | MonadComprehensions - | GeneralizedNewtypeDeriving - | RecursiveDo - | PostfixOperators - | TupleSections - | PatternGuards - | LiberalTypeSynonyms - | RankNTypes - | ImpredicativeTypes - | TypeOperators - | ExplicitNamespaces - | PackageImports - | ExplicitForAll - | AlternativeLayoutRule - | AlternativeLayoutRuleTransitional - | DatatypeContexts - | NondecreasingIndentation - | RelaxedLayout - | TraditionalRecordSyntax - | LambdaCase - | MultiWayIf - | BinaryLiterals - | NegativeLiterals - | DuplicateRecordFields - | OverloadedLabels - | EmptyCase - | PatternSynonyms - | PartialTypeSignatures - | NamedWildCards - | StaticPointers - | TypeApplications - | Strict - | StrictData - | MonadFailDesugaring - deriving (Eq, Enum, Show, Generic) +import GHC.LanguageExtensions.Type instance Binary Extension diff --git a/libraries/ghc-boot/changelog.md b/libraries/ghc-boot/changelog.md index e0b4d69aa7..3ed5bbbfd2 100644 --- a/libraries/ghc-boot/changelog.md +++ b/libraries/ghc-boot/changelog.md @@ -1,4 +1,4 @@ -## 0.0.0.0 *Feb 2016* +## 8.0.1 *May 2016* * Bundled with GHC 8.0.1 diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in index b7d3955190..eed11e3b43 100644 --- a/libraries/ghc-boot/ghc-boot.cabal.in +++ b/libraries/ghc-boot/ghc-boot.cabal.in @@ -22,7 +22,7 @@ description: This library is shared between GHC, ghc-pkg, and other boot The package database format and this library are constructed in such a way that while ghc-pkg depends on Cabal, the GHC library and program do not have to depend on Cabal. -cabal-version: >=1.10 +cabal-version: >=1.22 build-type: Simple extra-source-files: changelog.md @@ -36,14 +36,17 @@ Library other-extensions: DeriveGeneric, RankNTypes, ScopedTypeVariables exposed-modules: - GHC.Lexeme - GHC.PackageDb GHC.LanguageExtensions + GHC.PackageDb GHC.Serialized + reexported-modules: + GHC.LanguageExtensions.Type, + GHC.Lexeme + build-depends: base >= 4.7 && < 4.10, binary == 0.8.*, bytestring == 0.10.*, directory == 1.2.*, - filepath >= 1.3 && < 1.5 - + filepath >= 1.3 && < 1.5, + ghc-boot-th == @ProjectVersionMunged@ diff --git a/libraries/template-haskell/Language/Haskell/TH/LanguageExtensions.hs b/libraries/template-haskell/Language/Haskell/TH/LanguageExtensions.hs index 8a64490676..2043e89f6a 100644 --- a/libraries/template-haskell/Language/Haskell/TH/LanguageExtensions.hs +++ b/libraries/template-haskell/Language/Haskell/TH/LanguageExtensions.hs @@ -19,4 +19,4 @@ module Language.Haskell.TH.LanguageExtensions -- This module exists primarily to avoid inserting a massive list of language -- extensions into the already quite large Haddocks for Language.Haskell.TH -import GHC.LanguageExtensions (Extension(..)) +import GHC.LanguageExtensions.Type (Extension(..)) diff --git a/libraries/template-haskell/template-haskell.cabal b/libraries/template-haskell/template-haskell.cabal index 7241708473..0d9f468327 100644 --- a/libraries/template-haskell/template-haskell.cabal +++ b/libraries/template-haskell/template-haskell.cabal @@ -49,9 +49,9 @@ Library Language.Haskell.TH.Lib.Map build-depends: - base >= 4.8 && < 4.10, - ghc-boot == 8.1, - pretty == 1.1.* + base >= 4.8 && < 4.10, + ghc-boot-th == 8.1, + pretty == 1.1.* -- We need to set the unit ID to template-haskell (without a -- version number) as it's magic. diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index afcac7c6b7..33fec8e9d5 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -4,10 +4,9 @@ TYPE CONSTRUCTORS data T (a :: k) COERCION AXIOMS Dependent modules: [] -Dependent packages: [array-0.5.1.0, base-4.9.0.0, binary-0.8.2.0, - bytestring-0.10.7.0, containers-0.5.7.1, deepseq-1.4.2.0, - ghc-boot-8.1, ghc-prim-0.5.0.0, integer-gmp-1.0.0.1, - pretty-1.1.3.2, template-haskell-2.11.0.0] +Dependent packages: [array-0.5.1.1, base-4.9.0.0, deepseq-1.4.2.0, + ghc-boot-th-8.1, ghc-prim-0.5.0.0, integer-gmp-1.0.0.1, + pretty-1.1.3.3, template-haskell-2.11.0.0] ==================== Typechecker ==================== TH_Roles2.$tcT diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index be6828fe4d..1cebbe896a 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -287,7 +287,8 @@ test('T8028', ['T8028', '-v0 ' + config.ghc_th_way_flags]) test('TH_Roles1', normal, compile_fail, ['-v0']) -test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim', 'ghc-boot', +test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim', + 'ghc-boot', 'ghc-boot-th', 'integer-gmp', 'pretty', 'template-haskell', 'binary', 'bytestring', 'containers' ), compile, ['-v0 -ddump-tc']) |