packages feed

base-noprelude (empty) → 4.3.0.0

raw patch · 3 files changed

+140/−0 lines, 3 filesdep +basebuild-type:Customsetup-changed

Dependencies added: base

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2015, Herbert Valerio Riedel++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 the name of Herbert Valerio Riedel nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 COPYRIGHT+OWNER OR 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.
+ Setup.hs view
@@ -0,0 +1,79 @@+{-# LANGUAGE RecordWildCards #-}++import Data.List (isPrefixOf)+import           Control.Monad+import           Data.Maybe+import qualified Distribution.InstalledPackageInfo  as IPI+import qualified Distribution.ModuleName            as MN+import           Distribution.PackageDescription    as PD+import           Distribution.Simple+import           Distribution.Simple.BuildPaths+import           Distribution.Simple.LocalBuildInfo+import qualified Distribution.Simple.PackageIndex   as PI+import           Distribution.Simple.Setup+import           Distribution.Simple.Utils          (createDirectoryIfMissingVerbose, die,+                                                     info, notice, warn, rewriteFile, cabalVersion)+import           Distribution.Text                  (display)+import           System.FilePath                    (takeDirectory, (<.>),+                                                   (</>))+import           Data.Version++main :: IO ()+main = defaultMainWithHooks+         simpleUserHooks { confHook = confHook',  buildHook = buildHook' }++confHook' :: (GenericPackageDescription, HookedBuildInfo) -> ConfigFlags -> IO LocalBuildInfo+confHook' gpd_hbi cflags = do+    unless (versionBranch cabalVersion < [1,21]) $+        die ("base-noprelude cannot be built with Cabal versions newer than 1.20 (`Setup.hs` imported Cabal library version " ++ showVersion cabalVersion ++ ")")++    lbi <- confHook simpleUserHooks gpd_hbi cflags++    let pkgver = pkgVersion . PD.package . localPkgDescr $ lbi++    let (baseVer,baseMods0) = case PI.lookupPackageName (installedPkgs lbi) (PackageName "base") of+                     [(ver', [IPI.InstalledPackageInfo {..}])] -> (ver',map stringlyCoerce exposedModules)++        -- filter out Prelude module from `base`'s exposed module list+        baseMods = filter (/= MN.fromString "Prelude") baseMods0++    unless (versionBranch baseVer `isPrefixOf` versionBranch pkgver) $+        die ("version doesn't match base package version" ++ show (pkgver,baseVer))++    return $! (mapLocalPkgDescr . mapLibrary . fmap . mapExposedModules) (const baseMods) lbi+  where+    -- needed to make compile w/ Cabal >= 1.22+    stringlyCoerce = MN.fromString . display++    -- pseudo-functors+    mapLocalPkgDescr  f lbi = lbi { localPkgDescr  = f (localPkgDescr lbi) }+    mapLibrary        f pd  = pd  { library        = f (library       pd)  }+    mapExposedModules f l   = l   { exposedModules = f (exposedModules l)  }++    verbosity = fromFlag $ configVerbosity cflags++-- buildHook' :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO ()+buildHook' pd lbi uh bflags = do+    notice verbosity "creating wrapper modules..."++    forM_ baseMods $ \m -> do+        info verbosity ("generating wrapper module for " ++ display m)+        createDirectoryIfMissingVerbose verbosity True (takeDirectory $ apath m)+        rewriteFile (apath m) (genWrapper m)++    buildHook simpleUserHooks pd lbi uh bflags+  where+    genWrapper mn = unlines+                    [ "module " ++ display mn ++ "(module M) where"+                    , "import \"base\" " ++ display mn ++ " as M"+                    ]++    apath mn = autogenModulesDir lbi </> MN.toFilePath mn <.> "hs"++    baseMods = (exposedModules . fromJust . library) pd+    verbosity = fromFlag $ buildVerbosity bflags++-- postBuild' :: Args -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()+postBuild' args bflags pd lbi = do+    putStrLn "postBuild"+    postBuild simpleUserHooks args bflags pd lbi
+ base-noprelude.cabal view
@@ -0,0 +1,31 @@+name:                base-noprelude+version:             4.3.0.0+synopsis:            "base" package sans "Prelude" module+homepage:            https://github.com/hvr/base-noprelude+bug-reports:         https://github.com/hvr/base-noprelude/issues+license:             BSD3+license-file:        LICENSE+author:              Herbert Valerio Riedel+maintainer:          hvr@gnu.org+category:            Development+build-type:          Custom+cabal-version:       >=1.10+description:+    This package simplifies defining custom "Prelude"s without having+    to use @-XNoImplicitPrelude@ by re-exporting the full+    module-hierarchy of the+    <http://hackage.haskell.org/package/base-4.3.0.0 base-4.3.0.0>+    package /except/ for the "Prelude" module.+    .+    Each version of @base-noprelude@ depends on a specific+    @base@-version and thus mirrors @base@'s+    versioning (with the exception that @base-noprelude@ needs to add an+    /additional/ 5th version component in case of bug-fix releases).+    .+    See <https://github.com/hvr/base-noprelude> for more information.++library+    build-depends:       base ==4.3.0.0+    default-language:    Haskell2010+    default-extensions:  PackageImports+    exposed:             False