Rodrigo Mesquita pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC

Commits:

10 changed files:

Changes:

  • compiler/GHC/Driver/Pipeline/Execute.hs
    ... ... @@ -670,7 +670,6 @@ runHscPhase pipe_env hsc_env0 input_fn src_flavour = do
    670 670
       -- gather the imports and module name
    
    671 671
       (hspp_buf,mod_name,imps,src_imps) <- do
    
    672 672
         buf <- hGetStringBuffer input_fn
    
    673
    -    -- TODO: handle implicit knownkey names here?
    
    674 673
         let rn_pkg_qual = renameRawPkgQual (hsc_unit_env hsc_env)
    
    675 674
             rn_imps = fmap (\(s, rpk, lmn@(L _ mn)) -> (s, rn_pkg_qual mn rpk, lmn))
    
    676 675
             sec = initSourceErrorContext dflags
    

  • testsuite/tests/cabal/T27013a/Makefile
    1
    +TOP=../../..
    
    2
    +include $(TOP)/mk/boilerplate.mk
    
    3
    +include $(TOP)/mk/test.mk
    
    4
    +
    
    5
    +SETUP=./Setup -v0
    
    6
    +
    
    7
    +# Reproducer for #27013 (!15899#note_676801).
    
    8
    +#
    
    9
    +# The `composition` package depends on neither `base` nor `ghc-internal`
    
    10
    +# (see composition.cabal: no build-depends). It uses NoImplicitPrelude
    
    11
    +# and defines its own `(.)`. Building it should not require GHC to load
    
    12
    +# known-key modules from `base` such as `GHC.Essentials`.
    
    13
    +
    
    14
    +T27013a: clean
    
    15
    +	'$(GHC_PKG)' init tmp.d
    
    16
    +	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make Setup
    
    17
    +	$(SETUP) clean
    
    18
    +	$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --with-hc-pkg='$(GHC_PKG)' --ghc-options='$(TEST_HC_OPTS)' --package-db=tmp.d
    
    19
    +	$(SETUP) build
    
    20
    +
    
    21
    +clean :
    
    22
    +	$(RM) -r tmp.d dist Setup$(exeext) *.o *.hi

  • testsuite/tests/cabal/T27013a/Setup.hs
    1
    +import Distribution.Simple
    
    2
    +main = defaultMain

  • testsuite/tests/cabal/T27013a/all.T
    1
    +test('T27013a',
    
    2
    +     [extra_files(['src/', 'composition.cabal', 'Setup.hs'])],
    
    3
    +     makefile_test,
    
    4
    +     [])

  • testsuite/tests/cabal/T27013a/composition.cabal
    1
    +name:                composition
    
    2
    +version:             1.0.2.2
    
    3
    +synopsis:            Combinators for unorthodox function composition
    
    4
    +
    
    5
    +license:             BSD3
    
    6
    +license-file:        LICENSE
    
    7
    +author:              Dan Burton
    
    8
    +maintainer:          danburton.email@gmail.com
    
    9
    +bug-reports:
    
    10
    +  https://github.com/DanBurton/composition/issues
    
    11
    +
    
    12
    +category:            Data
    
    13
    +build-type:          Simple
    
    14
    +cabal-version:       >=1.10
    
    15
    +
    
    16
    +library
    
    17
    +  default-language:    Haskell2010
    
    18
    +  hs-source-dirs:      src
    
    19
    +  exposed-modules:     Data.Composition
    
    20
    +  default-extensions:  NoImplicitPrelude
    
    21
    +
    
    22
    +source-repository head
    
    23
    +  type:     git
    
    24
    +  location: git://github.com/DanBurton/composition.git

  • testsuite/tests/cabal/T27013a/src/Data/Composition.hs
    1
    +-- | This module is for convenience and demonstrative purposes
    
    2
    +-- more than it is for providing actual value.
    
    3
    +-- I do not recommend that you rely on this module
    
    4
    +-- for performance-sensitive code.
    
    5
    +-- Because this module is not based on Prelude's (.),
    
    6
    +-- some chances at optimization might be missed by your compiler.
    
    7
    +module Data.Composition (
    
    8
    +  -- * Math
    
    9
    +    ()
    
    10
    +
    
    11
    +  -- * Colons and dots
    
    12
    +  , (.:)
    
    13
    +  , (.:.)
    
    14
    +  , (.::)
    
    15
    +  , (.::.)
    
    16
    +  , (.:::)
    
    17
    +  , (.:::.)
    
    18
    +  , (.::::)
    
    19
    +  , (.::::.)
    
    20
    +
    
    21
    +  -- * Asterisks
    
    22
    +  , (.*)
    
    23
    +  , (.**)
    
    24
    +  , (.***)
    
    25
    +  , (.****)
    
    26
    +  , (.*****)
    
    27
    +  , (.******)
    
    28
    +  , (.*******)
    
    29
    +  , (.********)
    
    30
    +
    
    31
    +  -- * composeN
    
    32
    +  , compose1
    
    33
    +  , compose2
    
    34
    +  , compose3
    
    35
    +  , compose4
    
    36
    +  , compose5
    
    37
    +  , compose6
    
    38
    +  , compose7
    
    39
    +  , compose8
    
    40
    +  , compose9
    
    41
    +
    
    42
    +  ) where
    
    43
    +
    
    44
    +-- Not exported. This is defined here to remove the dependency on base
    
    45
    +(.) :: (b -> c) -> (a -> b) -> a -> c
    
    46
    +(f . g) x = f (g x)
    
    47
    +
    
    48
    +infixr 9 .
    
    49
    +
    
    50
    +-- | The mathematical symbol for function composition.
    
    51
    +() :: (b -> c) -> (a -> b) -> a -> c
    
    52
    +() = (.)
    
    53
    +
    
    54
    +infixr 9 
    
    55
    +
    
    56
    +-- | Compose two functions. @f .: g@ is similar to @f . g@
    
    57
    +-- except that @g@ will be fed /two/ arguments instead of one
    
    58
    +-- before handing its result to @f@.
    
    59
    +--
    
    60
    +-- This function is defined as
    
    61
    +--
    
    62
    +-- > (f .: g) x y = f (g x y)
    
    63
    +--
    
    64
    +-- Example usage:
    
    65
    +--
    
    66
    +-- > concatMap :: (a -> [b]) -> [a] -> [b]
    
    67
    +-- > concatMap = concat .: map
    
    68
    +--
    
    69
    +-- Notice how /two/ arguments
    
    70
    +-- (the function /and/ the list)
    
    71
    +-- will be given to @map@ before the result
    
    72
    +-- is passed to @concat@. This is equivalent to:
    
    73
    +--
    
    74
    +-- > concatMap f xs = concat (map f xs)
    
    75
    +(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
    
    76
    +(f .: g) x y = f (g x y)
    
    77
    +
    
    78
    +infixr 8 .:
    
    79
    +
    
    80
    +-- | Equivalent to '.:'
    
    81
    +--
    
    82
    +-- The pattern of appending asterisks is
    
    83
    +-- straightforward to extend to similar functions:
    
    84
    +-- (compose2 = .*, compose3 = .**, etc).
    
    85
    +-- However, @.:@ has been commonly adopted amongst Haskellers,
    
    86
    +-- and the need for compose3 and beyond is rare in practice.
    
    87
    +(.*) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
    
    88
    +(.*) = (.) . (.)
    
    89
    +
    
    90
    +infixr 8 .*
    
    91
    +
    
    92
    +(.**) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
    
    93
    +(.**) = (.) . (.*)
    
    94
    +
    
    95
    +(.***) = (.) . (.**)
    
    96
    +(.****) = (.) . (.***)
    
    97
    +(.*****) = (.) . (.****)
    
    98
    +(.******) = (.) . (.*****)
    
    99
    +(.*******) = (.) . (.******)
    
    100
    +(.********) = (.) . (.*******)
    
    101
    +
    
    102
    +infixr 8 .**
    
    103
    +infixr 8 .***
    
    104
    +infixr 8 .****
    
    105
    +infixr 8 .*****
    
    106
    +infixr 8 .******
    
    107
    +infixr 8 .*******
    
    108
    +infixr 8 .********
    
    109
    +
    
    110
    +
    
    111
    +-- | @composeN f g@ means give @g@ @N@ inputs
    
    112
    +-- and then pass its result to @f@.
    
    113
    +compose1 :: (b -> c) -> (a -> b) -> a -> c
    
    114
    +compose1 = (.)
    
    115
    +
    
    116
    +compose2 :: (c -> d) -> (a -> b -> c) -> a -> b -> d
    
    117
    +compose2 = (.*)
    
    118
    +
    
    119
    +compose3 :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
    
    120
    +compose3 = (.**)
    
    121
    +
    
    122
    +compose4 = (.***)
    
    123
    +compose5 = (.****)
    
    124
    +compose6 = (.*****)
    
    125
    +compose7 = (.******)
    
    126
    +compose8 = (.*******)
    
    127
    +compose9 = (.********)
    
    128
    +
    
    129
    +-- | One compact pattern for composition operators is to
    
    130
    +-- "count the dots after the first one",
    
    131
    +-- which begins with the common '.:', and proceeds by first
    
    132
    +-- appending another @.@ and then replacing it with @:@
    
    133
    +(.:.) :: (d -> e) -> (a -> b -> c -> d) -> a -> b -> c -> e
    
    134
    +(.:.) = (.**)
    
    135
    +
    
    136
    +(.::) = (.***)
    
    137
    +(.::.) = (.****)
    
    138
    +(.:::) = (.*****)
    
    139
    +(.:::.) = (.******)
    
    140
    +(.::::) = (.*******)
    
    141
    +(.::::.) = (.********)
    
    142
    +
    
    143
    +infixr 8 .:.
    
    144
    +infixr 8 .::
    
    145
    +infixr 8 .::.
    
    146
    +infixr 8 .:::
    
    147
    +infixr 8 .:::.
    
    148
    +infixr 8 .::::
    
    149
    +infixr 8 .::::.

  • testsuite/tests/driver/T27013b/Makefile
    1
    +TOP=../../..
    
    2
    +include $(TOP)/mk/boilerplate.mk
    
    3
    +include $(TOP)/mk/test.mk
    
    4
    +
    
    5
    +# Test that compiling X.hs without implicit Prelude does not recompile X the
    
    6
    +# second time or third time. In !15899, X.hs was recompiled because of an
    
    7
    +# incorrect "GHC.Essentials package changed"
    
    8
    +clean:
    
    9
    +	rm -f *.o *.hi
    
    10
    +
    
    11
    +T27013b: clean
    
    12
    +	'$(TEST_HC)' $(TEST_HC_OPTS) --make X.hs
    
    13
    +	'$(TEST_HC)' $(TEST_HC_OPTS) --make X.hs
    
    14
    +	'$(TEST_HC)' $(TEST_HC_OPTS) --make X.hs

  • testsuite/tests/driver/T27013b/T27013b.stdout
    1
    +[1 of 1] Compiling X                ( X.hs, X.o )

  • testsuite/tests/driver/T27013b/X.hs
    1
    +{-# LANGUAGE NoImplicitPrelude #-}
    
    2
    +module X where
    
    3
    +x = 3

  • testsuite/tests/driver/T27013b/all.T
    1
    +test('T27013b', [extra_files(['X.hs'])],
    
    2
    +     makefile_test, [])