basic-prelude 0.3.1.0 → 0.3.2.0
raw patch · 3 files changed
+36/−5 lines, 3 filesdep +lifted-basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: lifted-base
API changes (from Hackage documentation)
+ BasicPrelude: ltextToString :: LText -> String
+ BasicPrelude: textToString :: Text -> String
+ CorePrelude: bracket :: MonadBaseControl IO m => m a -> (a -> m b) -> (a -> m c) -> m c
+ CorePrelude: catch :: (MonadBaseControl IO m, Exception e) => m a -> (e -> m a) -> m a
+ CorePrelude: class IsString a
+ CorePrelude: class Typeable a
+ CorePrelude: data IOException :: *
+ CorePrelude: directory :: FilePath -> FilePath
+ CorePrelude: finally :: MonadBaseControl IO m => m a -> m b -> m a
+ CorePrelude: fromString :: IsString a => String -> a
+ CorePrelude: isJust :: Maybe a -> Bool
+ CorePrelude: isNothing :: Maybe a -> Bool
+ CorePrelude: lefts :: [Either a b] -> [a]
+ CorePrelude: listToMaybe :: [a] -> Maybe a
+ CorePrelude: maybeToList :: Maybe a -> [a]
+ CorePrelude: onException :: MonadBaseControl IO m => m a -> m b -> m a
+ CorePrelude: rights :: [Either a b] -> [b]
+ CorePrelude: try :: (MonadBaseControl IO m, Exception e) => m a -> m (Either e a)
+ CorePrelude: typeOf :: Typeable a => a -> TypeRep
- BasicPrelude: intercalate :: Text -> [Text] -> Text
+ BasicPrelude: intercalate :: Monoid w => w -> [w] -> w
- CorePrelude: throwIO :: Exception e => e -> IO a
+ CorePrelude: throwIO :: (MonadBase IO m, Exception e) => e -> m a
Files
- BasicPrelude.hs +15/−3
- CorePrelude.hs +19/−1
- basic-prelude.cabal +2/−1
BasicPrelude.hs view
@@ -19,6 +19,7 @@ , empty , (++) , concat+ , intercalate -- ** Strict implementation , sum , product@@ -37,7 +38,8 @@ , Text.words , Text.unlines , Text.unwords- , Text.intercalate+ , textToString+ , ltextToString -- ** Text operations (IO) , Text.putStr , Text.getLine@@ -79,12 +81,12 @@ ( -- prefer monoid versions instead (++) , concat+ , intercalate -- prefer Text versions instead , lines , words , unlines , unwords- , intercalate -- prefer map = fmap instead , map -- prefer strict versions@@ -100,7 +102,8 @@ import qualified Data.Text as Text import qualified Data.Text.IO as Text-import qualified Data.Text.Lazy.IO as LText +import qualified Data.Text.Lazy as LText+import qualified Data.Text.Lazy.IO as LText import qualified Filesystem.Path.CurrentOS as FilePath import qualified Prelude @@ -124,7 +127,11 @@ concat :: Monoid w => [w] -> w concat = mconcat +-- | > intercalate = mconcat .: intersperse+intercalate :: Monoid w => w -> [w] -> w+intercalate xs xss = mconcat (Data.List.intersperse xs xss) + -- | Compute the sum of a finite list of numbers. sum :: Num a => [a] -> a sum = foldl' (+) 0@@ -163,3 +170,8 @@ appendFile :: FilePath -> Text -> IO () appendFile = Text.appendFile . FilePath.encodeString +textToString :: Text -> Prelude.String+textToString = Text.unpack++ltextToString :: LText -> Prelude.String+ltextToString = LText.unpack
CorePrelude.hs view
@@ -41,6 +41,7 @@ , Prelude.Functor (..) , Prelude.Monad (..) , (Control.Monad.=<<)+ , Data.String.IsString (..) -- ** Numeric type classes , Prelude.Num (..) , Prelude.Real (..)@@ -101,8 +102,14 @@ , Data.Maybe.mapMaybe , Data.Maybe.catMaybes , Data.Maybe.fromMaybe+ , Data.Maybe.isJust+ , Data.Maybe.isNothing+ , Data.Maybe.listToMaybe+ , Data.Maybe.maybeToList -- ** Either , Data.Either.partitionEithers+ , Data.Either.lefts+ , Data.Either.rights -- ** Ord , Data.Function.on , Data.Ord.comparing@@ -118,8 +125,15 @@ , Control.Monad.IO.Class.liftIO -- ** Exceptions , Control.Exception.Exception (..)+ , Data.Typeable.Typeable (..) , Control.Exception.SomeException- , Control.Exception.throwIO+ , Control.Exception.IOException+ , Control.Exception.Lifted.throwIO+ , Control.Exception.Lifted.try+ , Control.Exception.Lifted.catch+ , Control.Exception.Lifted.bracket+ , Control.Exception.Lifted.onException+ , Control.Exception.Lifted.finally -- ** Files , F.FilePath , (F.</>)@@ -127,6 +141,7 @@ , F.hasExtension , F.basename , F.filename+ , F.directory -- ** Print , Prelude.print -- ** Command line args@@ -145,6 +160,8 @@ import qualified Control.Category import qualified Control.Monad import qualified Control.Exception+import qualified Control.Exception.Lifted+import qualified Data.Typeable import qualified Filesystem.Path.CurrentOS as F @@ -158,6 +175,7 @@ import qualified Data.Ord import qualified Data.Function import qualified Data.Tuple+import qualified Data.String import qualified Control.Monad.Trans.Class import qualified Control.Monad.IO.Class
basic-prelude.cabal view
@@ -1,5 +1,5 @@ name: basic-prelude-version: 0.3.1.0+version: 0.3.2.0 synopsis: An enhanced core prelude; a common foundation for alternate preludes. description: The premise of @basic-prelude@ is that there are a lot of very commonly desired features missing from the standard @Prelude@, such as commonly used operators (@\<$\>@ and @>=>@, for instance) and imports for common datatypes (e.g., @ByteString@ and @Vector@). At the same time, there are lots of other components which are more debatable, such as providing polymorphic versions of common functions.@@ -38,6 +38,7 @@ , vector , system-filepath >= 0.4 && < 0.5 , ReadArgs >= 1.2 && < 1.3+ , lifted-base source-repository head type: git