Ticket #132: Cabal.diff

File Cabal.diff, 24.1 KB (added by igloo, 5 years ago)

Patch to change GHC's parser to support (only) the proposed replacement syntax

  • Distribution/PackageDescription/Check.hs

    Sat Jul 25 22:19:51 BST 2009  Ian Lynagh <igloo@earth.li>
      * Make the code compatible with the stricter labelled-field parsing rules
    diff -rN -u old-Cabal/Distribution/PackageDescription/Check.hs new-Cabal/Distribution/PackageDescription/Check.hs
    old new  
    971971checkConfigureExists :: Monad m => CheckPackageContentOps m 
    972972                     -> PackageDescription 
    973973                     -> m (Maybe PackageCheck) 
    974 checkConfigureExists ops PackageDescription { buildType = Just Configure } = do 
     974checkConfigureExists ops (PackageDescription { buildType = Just Configure }) = do 
    975975  exists <- doesFileExist ops "configure" 
    976976  return $ check (not exists) $ 
    977977    PackageBuildWarning $ 
  • Distribution/PackageDescription/Parse.hs

    diff -rN -u old-Cabal/Distribution/PackageDescription/Parse.hs new-Cabal/Distribution/PackageDescription/Parse.hs
    old new  
    162162-- | Store any fields beginning with "x-" in the customFields field of 
    163163--   a PackageDescription.  All other fields will generate a warning. 
    164164storeXFieldsPD :: UnrecFieldParser PackageDescription 
    165 storeXFieldsPD (f@('x':'-':_),val) pkg = Just pkg{ customFieldsPD = (f,val):(customFieldsPD pkg) } 
     165storeXFieldsPD (f@('x':'-':_),val) pkg = Just $ pkg{ customFieldsPD = (f,val):(customFieldsPD pkg) } 
    166166storeXFieldsPD _ _ = Nothing 
    167167 
    168168-- --------------------------------------------------------------------------- 
     
    276276 ] 
    277277 
    278278storeXFieldsBI :: UnrecFieldParser BuildInfo 
    279 storeXFieldsBI (f@('x':'-':_),val) bi = Just bi{ customFieldsBI = (f,val):(customFieldsBI bi) } 
     279storeXFieldsBI (f@('x':'-':_),val) bi = Just $ bi{ customFieldsBI = (f,val):(customFieldsBI bi) } 
    280280storeXFieldsBI _ _ = Nothing 
    281281 
    282282------------------------------------------------------------------------------ 
     
    513513          maybeWarnCabalVersion pkg       -- without Cabal >= 1.2 
    514514        checkForUndefinedFlags flags mlib exes 
    515515        return $ GenericPackageDescription 
    516                    pkg { sourceRepos = repos } 
     516                   (pkg { sourceRepos = repos }) 
    517517                   flags mlib exes 
    518518 
    519519  where 
  • Distribution/PackageDescription.hs

    diff -rN -u old-Cabal/Distribution/PackageDescription.hs new-Cabal/Distribution/PackageDescription.hs
    old new  
    562562       --the lib only exists in the buildinfo file.  FIX: Is this 
    563563       --wrong?  If there aren't any exposedModules, then the library 
    564564       --won't build anyway.  add to sanity checker? 
    565       updateLibrary (Just bi) Nothing     = Just emptyLibrary{libBuildInfo=bi} 
     565      updateLibrary (Just bi) Nothing     = Just $ emptyLibrary{libBuildInfo=bi} 
    566566 
    567567      updateExecutables :: [(String, BuildInfo)] -- ^[(exeName, new buildinfo)] 
    568568                        -> [Executable]          -- ^list of executables to update 
  • Distribution/Simple/Command.hs

    diff -rN -u old-Cabal/Distribution/Simple/Command.hs new-Cabal/Distribution/Simple/Command.hs
    old new  
    319319          Nothing -> [] 
    320320          Just True  -> ["--" ++ lfT] 
    321321          Just False -> ["--" ++ lfF] 
    322     showOptDescr x c@ChoiceOpt{} 
     322    showOptDescr x c@(ChoiceOpt{}) 
    323323      = ["--" ++ val | val <- getCurrentChoice c x] 
    324324    showOptDescr x (ReqArg _ (_ssff,lf:_) _ _ showflag) 
    325325      = [ "--"++lf++"="++flag 
  • Distribution/Simple/Configure.hs

    diff -rN -u old-Cabal/Distribution/Simple/Configure.hs new-Cabal/Distribution/Simple/Configure.hs
    old new  
    695695    updateLibrary Nothing    = return Nothing 
    696696    updateLibrary (Just lib) = do 
    697697      bi <- pkgconfigBuildInfo (pkgconfigDepends (libBuildInfo lib)) 
    698       return $ Just lib { libBuildInfo = libBuildInfo lib `mappend` bi } 
     698      return $ Just $ lib { libBuildInfo = libBuildInfo lib `mappend` bi } 
    699699 
    700700    updateExecutable exe = do 
    701701      bi <- pkgconfigBuildInfo (pkgconfigDepends (buildInfo exe)) 
    702       return exe { buildInfo = buildInfo exe `mappend` bi } 
     702      return $ exe { buildInfo = buildInfo exe `mappend` bi } 
    703703 
    704704    pkgconfigBuildInfo :: [Dependency] -> IO BuildInfo 
    705705    pkgconfigBuildInfo []      = return mempty 
  • Distribution/Simple/GHC/IPI641.hs

    diff -rN -u old-Cabal/Distribution/Simple/GHC/IPI641.hs new-Cabal/Distribution/Simple/GHC/IPI641.hs
    old new  
    8989  deriving Read 
    9090 
    9191toCurrent :: InstalledPackageInfo -> Current.InstalledPackageInfo 
    92 toCurrent ipi@InstalledPackageInfo{} = Current.InstalledPackageInfo { 
     92toCurrent ipi@(InstalledPackageInfo{}) = Current.InstalledPackageInfo { 
    9393    Current.package            = convertPackageId (package ipi), 
    9494    Current.license            = convertLicense (license ipi), 
    9595    Current.copyright          = copyright ipi, 
  • Distribution/Simple/GHC/IPI642.hs

    diff -rN -u old-Cabal/Distribution/Simple/GHC/IPI642.hs new-Cabal/Distribution/Simple/GHC/IPI642.hs
    old new  
    110110  deriving Read 
    111111 
    112112convertPackageId :: PackageIdentifier -> Current.PackageIdentifier 
    113 convertPackageId PackageIdentifier { pkgName = n, pkgVersion = v } = 
     113convertPackageId (PackageIdentifier { pkgName = n, pkgVersion = v }) = 
    114114  Current.PackageIdentifier (Current.PackageName n) v 
    115115 
    116116convertModuleName :: String -> ModuleName 
     
    126126convertLicense OtherLicense = Current.OtherLicense 
    127127 
    128128toCurrent :: InstalledPackageInfo -> Current.InstalledPackageInfo 
    129 toCurrent ipi@InstalledPackageInfo{} = Current.InstalledPackageInfo { 
     129toCurrent ipi@(InstalledPackageInfo{}) = Current.InstalledPackageInfo { 
    130130    Current.package            = convertPackageId (package ipi), 
    131131    Current.license            = convertLicense (license ipi), 
    132132    Current.copyright          = copyright ipi, 
  • Distribution/Simple/GHC.hs

    diff -rN -u old-Cabal/Distribution/Simple/GHC.hs new-Cabal/Distribution/Simple/GHC.hs
    old new  
    140140  -- location of ghc to help find ghc-pkg in the case that the user did not 
    141141  -- specify the location of ghc-pkg directly: 
    142142  (ghcPkgProg, ghcPkgVersion, conf'') <- 
    143     requireProgramVersion verbosity ghcPkgProgram { 
     143    requireProgramVersion verbosity (ghcPkgProgram { 
    144144      programFindLocation = guessGhcPkgFromGhcPath ghcProg 
    145     } 
     145    }) 
    146146    anyVersion (userMaybeSpecifyPath "ghc-pkg" hcPkgPath conf') 
    147147 
    148148  when (ghcVersion /= ghcPkgVersion) $ die $ 
     
    196196configureToolchain :: ConfiguredProgram -> ProgramConfiguration 
    197197                                        -> ProgramConfiguration 
    198198configureToolchain ghcProg = 
    199     addKnownProgram gccProgram { 
     199    addKnownProgram (gccProgram { 
    200200      programFindLocation = findProg gccProgram 
    201201                              [ baseDir </> "gcc.exe", 
    202202                                mingwDir </> "bin" </> "gcc.exe" ], 
    203203      programPostConf     = configureGcc 
    204     } 
    205   . addKnownProgram ldProgram { 
     204    }) 
     205  . addKnownProgram (ldProgram { 
    206206      programFindLocation = findProg ldProgram 
    207207                              [ libDir </> "ld.exe", 
    208208                                mingwDir </> "mingw32" </> "bin" </> "ld.exe" ], 
    209209      programPostConf     = configureLd 
    210     } 
     210    }) 
    211211  where 
    212212    compilerDir = takeDirectory (programPath ghcProg) 
    213213    baseDir     = takeDirectory compilerDir 
     
    595595buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo 
    596596                      -> Executable         -> ComponentLocalBuildInfo -> IO () 
    597597buildExe verbosity _pkg_descr lbi 
    598   exe@Executable { exeName = exeName', modulePath = modPath } clbi = do 
     598  exe@(Executable { exeName = exeName', modulePath = modPath }) clbi = do 
    599599  let pref = buildDir lbi 
    600600      runGhcProg = rawSystemProgramConf verbosity ghcProgram (withPrograms lbi) 
    601601 
     
    661661  | otherwise              = do 
    662662    warn verbosity $ "The ghc flag '-threaded' is not compatible with " 
    663663                  ++ "profiling in ghc-6.8 and older. It will be disabled." 
    664     return bi { options = filterHcOptions (/= "-threaded") (options bi) } 
     664    return $ bi { options = filterHcOptions (/= "-threaded") (options bi) } 
    665665  where 
    666666    mustFilterThreaded = prof && compilerVersion comp < Version [6, 10] [] 
    667667                      && "-threaded" `elem` hcOptions GHC bi 
     
    795795    = do let verbosity = fromFlag (copyVerbosity flags) 
    796796             binDir = bindir installDirs 
    797797         createDirectoryIfMissingVerbose verbosity True binDir 
    798          withExe pkg_descr $ \Executable { exeName = e } -> do 
     798         withExe pkg_descr $ \(Executable { exeName = e }) -> do 
    799799             let exeFileName = e <.> exeExtension 
    800800                 fixedExeBaseName = progprefix ++ e ++ progsuffix 
    801801                 installBinary dest = do 
     
    830830              -> FilePath  -- ^Build location 
    831831              -> PackageDescription -> IO () 
    832832installLib flags lbi targetDir dynlibTargetDir builtDir 
    833               pkg@PackageDescription{library=Just lib} = do 
     833              pkg@(PackageDescription{library=Just lib}) = do 
    834834        -- copy .hi files over: 
    835835        let verbosity = fromFlag (copyVerbosity flags) 
    836836            copy src dst n = do 
     
    869869    ifGHCi    = when (hasLib && withGHCiLib    lbi) 
    870870    ifShared  = when (hasLib && withSharedLib  lbi) 
    871871 
    872 installLib _ _ _ _ _ PackageDescription{library=Nothing} 
     872installLib _ _ _ _ _ (PackageDescription{library=Nothing}) 
    873873    = die $ "Internal Error. installLibGHC called with no library." 
    874874 
    875875-- | On MacOS X we have to call @ranlib@ to regenerate the archive index after 
  • Distribution/Simple/Haddock.hs

    diff -rN -u old-Cabal/Distribution/Simple/Haddock.hs new-Cabal/Distribution/Simple/Haddock.hs
    old new  
    223223                  -> HaddockArgs 
    224224                  -> (HaddockArgs -> IO a) 
    225225                  -> IO a 
    226 prepareSources verbosity lbi isVersion2 bi args@HaddockArgs{argTargets=files} k = 
     226prepareSources verbosity lbi isVersion2 bi args@(HaddockArgs{argTargets=files}) k = 
    227227              withTempDirectory verbosity (buildDir lbi) "tmp" $ \tmp -> 
    228                    mapM (mockPP tmp) files >>= \targets -> k args {argTargets=targets} 
     228                   mapM (mockPP tmp) files >>= \targets -> k (args {argTargets=targets}) 
    229229          where 
    230230            mockPP pref file = do  
    231231                 let (filePref, fileName) = splitFileName file 
  • Distribution/Simple/Hugs.hs

    diff -rN -u old-Cabal/Distribution/Simple/Hugs.hs new-Cabal/Distribution/Simple/Hugs.hs
    old new  
    153153buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo 
    154154                      -> Executable         -> ComponentLocalBuildInfo -> IO () 
    155155buildExe verbosity pkg_descr lbi 
    156   exe@Executable {modulePath=mainPath, buildInfo=bi} _clbi = do 
     156  exe@(Executable {modulePath=mainPath, buildInfo=bi}) _clbi = do 
    157157    let pref = scratchDir lbi 
    158158    createDirectoryIfMissingVerbose verbosity True pref 
    159159     
  • Distribution/Simple/Install.hs

    diff -rN -u old-Cabal/Distribution/Simple/Install.hs new-Cabal/Distribution/Simple/Install.hs
    old new  
    185185-- 
    186186installIncludeFiles :: Verbosity -> PackageDescription -> FilePath -> IO () 
    187187installIncludeFiles verbosity 
    188   PackageDescription { library = Just lib } destIncludeDir = do 
     188  (PackageDescription { library = Just lib }) destIncludeDir = do 
    189189 
    190190  incs <- mapM (findInc relincdirs) (installIncludes lbi) 
    191191  sequence_ 
  • Distribution/Simple/InstallDirs.hs

    diff -rN -u old-Cabal/Distribution/Simple/InstallDirs.hs new-Cabal/Distribution/Simple/InstallDirs.hs
    old new  
    318318       _              -> id) 
    319319  . appendSubdirs (</>) 
    320320  . fmap fromPathTemplate 
    321   $ substituteInstallDirTemplates env dirs { 
     321  $ substituteInstallDirTemplates env (dirs { 
    322322      prefix = case copydest of 
    323323        -- possibly override the prefix 
    324324        CopyPrefix p -> toPathTemplate p 
    325325        _            -> prefix dirs 
    326     } 
     326    }) 
    327327  where 
    328328    env = initialPathTemplateEnv pkgId compilerId 
    329329 
     
    350350  $ -- substitute the path template into each other, except that we map 
    351351    -- \$prefix back to $prefix. We're trying to end up with templates that 
    352352    -- mention no vars except $prefix. 
    353     substituteInstallDirTemplates env dirs { 
     353    substituteInstallDirTemplates env (dirs { 
    354354      prefix = PathTemplate [Variable PrefixVar] 
    355     } 
     355    }) 
    356356  where 
    357357    env = initialPathTemplateEnv pkgId compilerId 
    358358 
  • Distribution/Simple/LHC.hs

    diff -rN -u old-Cabal/Distribution/Simple/LHC.hs new-Cabal/Distribution/Simple/LHC.hs
    old new  
    158158configureToolchain :: ConfiguredProgram -> ProgramConfiguration 
    159159                                        -> ProgramConfiguration 
    160160configureToolchain lhcProg = 
    161     addKnownProgram gccProgram { 
     161    addKnownProgram (gccProgram { 
    162162      programFindLocation = findProg gccProgram (baseDir </> "gcc.exe"), 
    163163      programPostConf     = configureGcc 
    164     } 
    165   . addKnownProgram ldProgram { 
     164    }) 
     165  . addKnownProgram (ldProgram { 
    166166      programFindLocation = findProg ldProgram (libDir </> "ld.exe"), 
    167167      programPostConf     = configureLd 
    168     } 
     168    }) 
    169169  where 
    170170    compilerDir = takeDirectory (programPath lhcProg) 
    171171    baseDir     = takeDirectory compilerDir 
     
    492492buildExe :: Verbosity -> PackageDescription -> LocalBuildInfo 
    493493                      -> Executable         -> ComponentLocalBuildInfo -> IO () 
    494494buildExe verbosity _pkg_descr lbi 
    495   exe@Executable { exeName = exeName', modulePath = modPath } clbi = do 
     495  exe@(Executable { exeName = exeName', modulePath = modPath }) clbi = do 
    496496  let pref = buildDir lbi 
    497497      runGhcProg = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi) 
    498498 
     
    558558  | otherwise              = do 
    559559    warn verbosity $ "The ghc flag '-threaded' is not compatible with " 
    560560                  ++ "profiling in ghc-6.8 and older. It will be disabled." 
    561     return bi { options = filterHcOptions (/= "-threaded") (options bi) } 
     561    return $ bi { options = filterHcOptions (/= "-threaded") (options bi) } 
    562562  where 
    563563    mustFilterThreaded = prof && compilerVersion comp < Version [6, 10] [] 
    564564                      && "-threaded" `elem` hcOptions GHC bi 
     
    687687    = do let verbosity = fromFlag (copyVerbosity flags) 
    688688             binDir = bindir installDirs 
    689689         createDirectoryIfMissingVerbose verbosity True binDir 
    690          withExe pkg_descr $ \Executable { exeName = e } -> do 
     690         withExe pkg_descr $ \(Executable { exeName = e }) -> do 
    691691             let exeFileName = e <.> exeExtension 
    692692                 fixedExeBaseName = progprefix ++ e ++ progsuffix 
    693693                 installBinary dest = do 
     
    722722              -> FilePath  -- ^Build location 
    723723              -> PackageDescription -> IO () 
    724724installLib flags lbi targetDir dynlibTargetDir builtDir 
    725               pkg@PackageDescription{library=Just lib} = do 
     725              pkg@(PackageDescription{library=Just lib}) = do 
    726726        -- copy .hi files over: 
    727727        let copy src dst n = do 
    728728              createDirectoryIfMissingVerbose verbosity True dst 
     
    765765    verbosity = fromFlag (copyVerbosity flags) 
    766766    runLhc    = rawSystemProgramConf verbosity lhcProgram (withPrograms lbi) 
    767767 
    768 installLib _ _ _ _ _ PackageDescription{library=Nothing} 
     768installLib _ _ _ _ _ (PackageDescription{library=Nothing}) 
    769769    = die $ "Internal Error. installLibGHC called with no library." 
    770770 
    771771-- | use @ranlib@ or @ar -s@ to build an index. This is necessary on systems 
  • Distribution/Simple/PreProcess.hs

    diff -rN -u old-Cabal/Distribution/Simple/PreProcess.hs new-Cabal/Distribution/Simple/PreProcess.hs
    old new  
    401401    -- ldOptions for GHC's rts package: 
    402402    hackRtsPackage index = 
    403403      case PackageIndex.lookupPackageName index (PackageName "rts") of 
    404         [rts] -> PackageIndex.insert rts { Installed.ldOptions = [] } index 
     404        [rts] -> PackageIndex.insert (rts { Installed.ldOptions = [] }) index 
    405405        _ -> error "No (or multiple) ghc rts package is registered!!" 
    406406 
    407407getLdOptions :: BuildInfo -> [String] 
  • Distribution/Simple/Program/Db.hs

    diff -rN -u old-Cabal/Distribution/Simple/Program/Db.hs new-Cabal/Distribution/Simple/Program/Db.hs
    old new  
    197197         \(prog, path, args) -> Just (prog, path, args ++ args')) 
    198198  . updateConfiguredProgs 
    199199      (flip Map.update name $ 
    200          \prog -> Just prog { programArgs = programArgs prog ++ args' }) 
     200         \prog -> Just $ prog { programArgs = programArgs prog ++ args' }) 
    201201 
    202202 
    203203-- | Like 'userSpecifyPath' but for a list of progs and their paths. 
     
    384384 
    385385  case lookupProgram prog conf' of 
    386386    Nothing                           -> die notFound 
    387     Just configuredProg@ConfiguredProgram { programLocation = location } -> 
     387    Just configuredProg@(ConfiguredProgram { programLocation = location }) -> 
    388388      case programVersion configuredProg of 
    389389        Just version 
    390390          | withinRange version range -> return (configuredProg, version, conf') 
  • Distribution/Simple/Program/Run.hs

    diff -rN -u old-Cabal/Distribution/Simple/Program/Run.hs new-Cabal/Distribution/Simple/Program/Run.hs
    old new  
    7373 
    7474runProgramInvocation :: Verbosity -> ProgramInvocation -> IO () 
    7575runProgramInvocation verbosity 
    76   ProgramInvocation { 
     76  (ProgramInvocation { 
    7777    progInvokePath  = path, 
    7878    progInvokeArgs  = args, 
    7979    progInvokeEnv   = [], 
    8080    progInvokeCwd   = Nothing, 
    8181    progInvokeInput = Nothing 
    82   } = 
     82  }) = 
    8383  rawSystemExit verbosity path args 
    8484 
    8585runProgramInvocation verbosity 
    86   ProgramInvocation { 
     86  (ProgramInvocation { 
    8787    progInvokePath  = path, 
    8888    progInvokeArgs  = args, 
    8989    progInvokeEnv   = [], 
    9090    progInvokeCwd   = Nothing, 
    9191    progInvokeInput = Just input 
    92   } = 
     92  }) = 
    9393  rawSystemStdin verbosity path args input 
    9494 
    9595runProgramInvocation _ _ = 
     
    9898 
    9999getProgramInvocationOutput :: Verbosity -> ProgramInvocation -> IO String 
    100100getProgramInvocationOutput verbosity 
    101   ProgramInvocation { 
     101  (ProgramInvocation { 
    102102    progInvokePath  = path, 
    103103    progInvokeArgs  = args, 
    104104    progInvokeEnv   = [], 
    105105    progInvokeCwd   = Nothing, 
    106106    progInvokeInput = Nothing 
    107   } = 
     107  }) = 
    108108  rawSystemStdout verbosity path args 
    109109 
    110110getProgramInvocationOutput _ _ = 
  • Distribution/Simple/Program/Script.hs

    diff -rN -u old-Cabal/Distribution/Simple/Program/Script.hs new-Cabal/Distribution/Simple/Program/Script.hs
    old new  
    3636-- 
    3737invocationAsShellScript :: ProgramInvocation -> String 
    3838invocationAsShellScript 
    39   ProgramInvocation { 
     39 (ProgramInvocation { 
    4040    progInvokePath  = path, 
    4141    progInvokeArgs  = args, 
    4242    progInvokeEnv   = envExtra, 
    4343    progInvokeCwd   = mcwd, 
    4444    progInvokeInput = minput 
    45   } = unlines $ 
     45  }) = unlines $ 
    4646          [ "#!/bin/sh" ] 
    4747       ++ [ "export " ++ var ++ "=" ++ quote val 
    4848          | (var,val) <- envExtra ] 
     
    6565-- 
    6666invocationAsBatchFile :: ProgramInvocation -> String 
    6767invocationAsBatchFile 
    68   ProgramInvocation { 
     68 (ProgramInvocation { 
    6969    progInvokePath  = path, 
    7070    progInvokeArgs  = args, 
    7171    progInvokeEnv   = envExtra, 
    7272    progInvokeCwd   = mcwd, 
    7373    progInvokeInput = minput 
    74   } = unlines $ 
     74  }) = unlines $ 
    7575          [ "@echo off" ] 
    7676       ++ [ "set " ++ var ++ "=" ++ escape val | (var,val) <- envExtra ] 
    7777       ++ [ "cd \"" ++ cwd ++ "\"" | cwd <- maybeToList mcwd ] 
  • Distribution/Simple/Register.hs

    diff -rN -u old-Cabal/Distribution/Simple/Register.hs new-Cabal/Distribution/Simple/Register.hs
    old new  
    116116register :: PackageDescription -> LocalBuildInfo 
    117117         -> RegisterFlags -- ^Install in the user's database?; verbose 
    118118         -> IO () 
    119 register pkg@PackageDescription { library       = Just lib  } 
    120          lbi@LocalBuildInfo     { libraryConfig = Just clbi } regFlags 
     119register pkg@(PackageDescription { library       = Just lib  }) 
     120         lbi@(LocalBuildInfo     { libraryConfig = Just clbi }) regFlags 
    121121  -- Three different modes: 
    122122  | modeGenerateRegFile   = writeRegistrationFile 
    123123  | modeGenerateRegScript = writeRegisterScript 
  • Distribution/Simple/SrcDist.hs

    diff -rN -u old-Cabal/Distribution/Simple/SrcDist.hs new-Cabal/Distribution/Simple/SrcDist.hs
    old new  
    152152  let targetDir = tmpDir </> tarBallName pkg_descr 
    153153  createDirectoryIfMissingVerbose verbosity True targetDir 
    154154  -- maybe move the library files into place 
    155   withLib $ \Library { exposedModules = modules, libBuildInfo = libBi } -> 
     155  withLib $ \(Library { exposedModules = modules, libBuildInfo = libBi }) -> 
    156156    prepareDir verbosity pkg_descr distPref targetDir pps modules libBi 
    157157  -- move the executables into place 
    158   withExe $ \Executable { modulePath = mainPath, buildInfo = exeBi } -> do 
     158  withExe $ \(Executable { modulePath = mainPath, buildInfo = exeBi }) -> do 
    159159    prepareDir verbosity pkg_descr distPref targetDir pps [] exeBi 
    160160    srcMainFile <- do 
    161161      ppFile <- findFileWithExtension (ppSuffixes pps) (hsSourceDirs exeBi) (dropExtension mainPath) 
  • Distribution/Simple.hs

    diff -rN -u old-Cabal/Distribution/Simple.hs new-Cabal/Distribution/Simple.hs
    old new  
    151151defaultMainNoRead :: GenericPackageDescription -> IO () 
    152152defaultMainNoRead pkg_descr = 
    153153  getArgs >>= 
    154   defaultMainHelper simpleUserHooks { readDesc = return (Just pkg_descr) } 
     154  defaultMainHelper (simpleUserHooks { readDesc = return (Just pkg_descr) }) 
    155155 
    156156defaultMainHelper :: UserHooks -> Args -> IO () 
    157157defaultMainHelper hooks args = topHandler $ 
     
    249249             (withPrograms lbi) 
    250250 
    251251  hookedAction preBuild buildHook postBuild 
    252                (return lbi { withPrograms = progs }) 
     252               (return $ lbi { withPrograms = progs }) 
    253253               hooks flags args 
    254254 
    255255hscolourAction :: UserHooks -> HscolourFlags -> Args -> IO () 
     
    271271             (withPrograms lbi) 
    272272 
    273273  hookedAction preHaddock haddockHook postHaddock 
    274                (return lbi { withPrograms = progs }) 
     274               (return $ lbi { withPrograms = progs }) 
    275275               hooks flags args 
    276276 
    277277cleanAction :: UserHooks -> CleanFlags -> Args -> IO () 
     
    361361  case pkgDescrFile lbi of 
    362362    Nothing -> return () 
    363363    Just pkg_descr_file -> checkPersistBuildConfig distPref pkg_descr_file 
    364   return lbi { 
     364  return $ lbi { 
    365365    withPrograms = restoreProgramConfiguration 
    366366                     (builtinPrograms ++ hookedPrograms hooks) 
    367367                     (withPrograms lbi)