base-prelude 0.1.13 → 0.1.14
raw patch · 2 files changed
+5/−43 lines, 2 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- BasePrelude: Down :: a -> Down a
- BasePrelude: instance Eq a => Eq (Down a)
- BasePrelude: instance Ord a => Ord (Down a)
- BasePrelude: instance Read a => Read (Down a)
- BasePrelude: instance Show a => Show (Down a)
- BasePrelude: newtype Down a
- BasePrelude: readEither :: Read a => String -> Either String a
- BasePrelude: readMaybe :: Read a => String -> Maybe a
Files
- base-prelude.cabal +2/−2
- library/BasePrelude.hs +3/−41
base-prelude.cabal view
@@ -1,7 +1,7 @@ name: base-prelude version:- 0.1.13+ 0.1.14 synopsis: The most complete prelude formed from only the "base" package description:@@ -47,6 +47,6 @@ exposed-modules: BasePrelude build-depends:- base >= 4.5 && < 4.8+ base >= 4.6 && < 4.9 default-language: Haskell2010
library/BasePrelude.hs view
@@ -6,18 +6,13 @@ module BasePrelude ( module Exports,- -- * Reimplementations of functions presented in versions of \"base\" newer than 4.5+ -- * Reimplementations of functions presented in versions of \"base\" newer than 4.6 -- ** Data.Bool bool, -- ** Debug.Trace traceShowId, traceM, traceShowM,- -- ** Data.Ord- Down(..),- -- ** Text.Read- readEither,- readMaybe, ) where @@ -47,6 +42,7 @@ 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 import Data.Ratio as Exports import Data.STRef as Exports import Data.String as Exports@@ -72,7 +68,7 @@ import System.Timeout as Exports import Text.ParserCombinators.ReadP as Exports (ReadP, ReadS, readP_to_S, readS_to_P) import Text.ParserCombinators.ReadPrec as Exports (ReadPrec, readPrec_to_P, readP_to_Prec, readPrec_to_S, readS_to_Prec)-import Text.Read as Exports (Read(..))+import Text.Read as Exports (Read(..), readMaybe, readEither) import Unsafe.Coerce as Exports import qualified Text.ParserCombinators.ReadPrec as ReadPrec@@ -118,37 +114,3 @@ -} traceShowM :: (Show a, Monad m) => a -> m () traceShowM = traceM . show---- | The 'Down' type allows you to reverse sort order conveniently. A value of type--- @'Down' a@ contains a value of type @a@ (represented as @'Down' a@).--- If @a@ has an @'Ord'@ instance associated with it then comparing two--- values thus wrapped will give you the opposite of their normal sort order.--- This is particularly useful when sorting in generalised list comprehensions,--- as in: @then sortWith by 'Down' x@-newtype Down a = Down a deriving (Eq, Show, Read)--instance Ord a => Ord (Down a) where- compare (Down x) (Down y) = y `compare` x----- | Parse a string using the 'Read' instance.--- Succeeds if there is exactly one valid result.--- A 'Left' value indicates a parse error.-readEither :: Read a => String -> Either String a-readEither s =- case [ x | (x,"") <- ReadPrec.readPrec_to_S read' ReadPrec.minPrec s ] of- [x] -> Right x- [] -> Left "Prelude.read: no parse"- _ -> Left "Prelude.read: ambiguous parse"- where- read' =- do x <- readPrec- ReadPrec.lift ReadP.skipSpaces- return x---- | Parse a string using the 'Read' instance.--- Succeeds if there is exactly one valid result.-readMaybe :: Read a => String -> Maybe a-readMaybe s = case readEither s of- Left _ -> Nothing- Right a -> Just a