base-prelude (empty) → 0.1.0
raw patch · 4 files changed
+180/−0 lines, 4 filesdep +basesetup-changed
Dependencies added: base
Files
- LICENSE +22/−0
- Setup.hs +2/−0
- base-prelude.cabal +54/−0
- library/BasePrelude.hs +102/−0
+ LICENSE view
@@ -0,0 +1,22 @@+Copyright (c) 2014, Nikita Volkov++Permission is hereby granted, free of charge, to any person+obtaining a copy of this software and associated documentation+files (the "Software"), to deal in the Software without+restriction, including without limitation the rights to use,+copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the+Software is furnished to do so, subject to the following+conditions:++The above copyright notice and this permission notice shall be+included in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR+OTHER DEALINGS IN THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ base-prelude.cabal view
@@ -0,0 +1,54 @@+name:+ base-prelude+version:+ 0.1.0+synopsis:+ The most complete prelude formed from only the "base" package+description:+ A library which reexports all non-conflicting and+ most general definitions from the \"base\" package.+ This includes APIs for applicatives, arrows, monoids, foldables, traversables,+ exceptions, generics, ST, MVars and STM.+ .+ This package will never have any dependencies other than \"base\".+category:+ Prelude+homepage:+ https://github.com/nikita-volkov/base-prelude +bug-reports:+ https://github.com/nikita-volkov/base-prelude/issues +author:+ Nikita Volkov <nikita.y.volkov@mail.ru>+maintainer:+ Nikita Volkov <nikita.y.volkov@mail.ru>+copyright:+ (c) 2014, Nikita Volkov+license:+ MIT+license-file:+ LICENSE+build-type:+ Simple+cabal-version:+ >=1.10+++source-repository head+ type:+ git+ location:+ git://github.com/nikita-volkov/base-prelude.git+++library+ hs-source-dirs:+ library+ other-modules:+ exposed-modules:+ BasePrelude+ build-depends:+ base >= 4.5 && < 4.8+ default-extensions:+ Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs, GeneralizedNewtypeDeriving, ImpredicativeTypes, LambdaCase, LiberalTypeSynonyms, MagicHash, MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude, NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables, StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies, TypeOperators, UnboxedTuples+ default-language:+ Haskell2010
+ library/BasePrelude.hs view
@@ -0,0 +1,102 @@+-- |+-- This module reexports most of the definitions from the \"base\" package,+-- which are meant to be imported unqualified.+-- -- For details check out the source.+module BasePrelude+( + module Exports,+ -- * Reimplementations of functions presented in versions of \"base\" newer than 4.5+ -- ** Data.Bool+ bool,+ -- ** Debug.Trace+ traceShowId,+ traceM,+ traceShowM,+)+where++-- Reexports+-------------------------++import Control.Applicative as Exports+import Control.Arrow as Exports+import Control.Category as Exports+import Control.Exception as Exports+import Control.Monad as Exports hiding (mapM_, sequence_, forM_, msum, mapM, sequence, forM)+import Control.Monad.ST as Exports+import Data.Bits as Exports+import Data.Bool as Exports hiding (bool)+import Data.Data as Exports+import Data.Either as Exports+import Data.Fixed as Exports+import Data.Foldable as Exports+import Data.Function as Exports hiding ((.), id)+import Data.Int as Exports+import Data.IORef as Exports+import Data.Ix as Exports+import Data.List as Exports hiding (concat, foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR, foldl')+import Data.Maybe as Exports+import Data.Monoid as Exports+import Data.Ord as Exports (Down(..))+import Data.Ratio as Exports+import Data.STRef as Exports+import Data.String as Exports+import Data.Traversable as Exports+import Data.Tuple as Exports+import Data.Word as Exports+import Debug.Trace as Exports hiding (traceShowId, traceM, traceShowM)+import GHC.Conc as Exports+import GHC.Exts as Exports (lazy, inline)+import GHC.Generics as Exports (Generic)+import GHC.IO.Exception as Exports+import Prelude as Exports hiding (concat, foldr, mapM_, sequence_, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl, foldr1, notElem, or, mapM, sequence, FilePath, id, (.))+import System.Exit as Exports+import System.IO as Exports (Handle, hClose)+import System.IO.Error as Exports+import System.IO.Unsafe as Exports+import System.Mem as Exports+import System.Mem.StableName as Exports+import System.Timeout as Exports+import Text.Read as Exports (readMaybe, readEither)+import Unsafe.Coerce as Exports++-- Reimplementations+-------------------------++-- | Case analysis for the 'Bool' type.+-- @bool a b p@ evaluates to @a@ when @p@ is @False@, and evaluates to @b@+-- when @p@ is @True@.+bool :: a -> a -> Bool -> a+bool f t = \case False -> f; True -> t++{-|+Like 'traceShow' but returns the shown value instead of a third value.+-}+traceShowId :: (Show a) => a -> a+traceShowId a = trace (show a) a++{-|+Like 'trace' but returning unit in an arbitrary monad. Allows for convenient+use in do-notation. Note that the application of 'trace' is not an action in the+monad, as 'traceIO' is in the 'IO' monad.++> ... = do+> x <- ...+> traceM $ "x: " ++ show x+> y <- ...+> traceM $ "y: " ++ show y+-}+traceM :: (Monad m) => String -> m ()+traceM string = trace string $ return ()++{-|+Like 'traceM', but uses 'show' on the argument to convert it to a 'String'.++> ... = do+> x <- ...+> traceMShow $ x+> y <- ...+> traceMShow $ x + y+-}+traceShowM :: (Show a, Monad m) => a -> m ()+traceShowM = traceM . show