packages feed

intro 0.1.0.9 → 0.1.0.10

raw patch · 4 files changed

+60/−27 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Intro: fail :: MonadFail m => String -> m a
+ Intro: fail :: MonadFail m => Text -> m a
- Intro: show :: (Show a, ConvertibleStrings String b) => a -> b
+ Intro: show :: (Show a, IsString s) => a -> s

Files

intro.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           intro-version:        0.1.0.9+version:        0.1.0.10 synopsis:       "Fixed Prelude" - Mostly total and safe, provides Text and Monad transformers description:    Intro is a modern Prelude which provides safe alternatives                 for most of the partial functions and follows other
src/Intro.hs view
@@ -45,7 +45,7 @@ -- Some 'Prelude' functions are missing from 'Intro'. More general variants are available for the following functions: -- -- * '>>' = 'Control.Applicative.*>'--- * '++' = 'Data.Semigroup.<>'+-- * '++' = '<>' -- * 'concat' = 'Data.Monoid.mconcat' -- * 'fmap' is replaced by generalized 'map' -- * 'mapM' = 'Control.Applicative.traverse'@@ -70,7 +70,7 @@ -- * 'gcd' and 'lcm' are not commonly used. -- * 'error' and 'errorWithoutStackTrace' are not provided. Use 'panic' instead. -- * 'ioError' and 'userError' are not provided. Import modules for exception handling separately if needed.--- * Some 'Text.Read' and 'Text.Show' class functions are not provided. Don't write these instances yourself.+-- * Some 'Read' and 'Show' class functions are not provided. Don't write these instances yourself. -- -- Additional types and functions: --@@ -228,8 +228,8 @@   -- * Text types    -- ** Char and String-  , Prelude.Char-  , Prelude.String+  , Data.Char.Char+  , Data.String.String    -- ** Text   , Data.Text.Text@@ -492,12 +492,11 @@   , Data.List.NonEmpty.some1    -- ** Monad-#if MIN_VERSION_base(4,9,0)   , Control.Monad.Monad((>>=))-  , Control.Monad.Fail.MonadFail(fail)-#else-  , Control.Monad.Monad((>>=), fail)+#if MIN_VERSION_base(4,9,0)+  , Control.Monad.Fail.MonadFail #endif+  , fail   , Control.Monad.Fix.MonadFix(mfix)   , (Control.Monad.=<<)   , (Control.Monad.<=<)@@ -643,7 +642,7 @@   --, interact    -- ** File-  , Prelude.FilePath+  , System.IO.FilePath   , readFile   , writeFile   , appendFile@@ -663,13 +662,18 @@  import Control.Monad.Trans (MonadIO(liftIO)) import Data.ByteString (ByteString)+import Data.Char (Char) import Data.Function ((.), ($))+import Data.Functor (Functor(fmap)) import Data.Maybe (Maybe, fromMaybe)-import Data.Semigroup ((<>))+import Data.Semigroup (Semigroup((<>)))+import Data.String (IsString(fromString), String) import Data.String.Conversions (ConvertibleStrings(convertString)) import Data.Text (Text) import Intro.Trustworthy (HasCallStack, IsList(Item, toList, fromList))-import Prelude (String, Char, FilePath, Show)+import System.IO (FilePath)+import Text.Read (Read)+import Text.Show (Show) import qualified Control.Applicative import qualified Control.Category import qualified Control.DeepSeq@@ -716,7 +720,6 @@ import qualified Data.Semigroup import qualified Data.Sequence import qualified Data.Set-import qualified Data.String import qualified Data.Tagged import qualified Data.Text.IO import qualified Data.Text.Lazy@@ -759,16 +762,16 @@ convertList = fromList . toList {-# INLINE convertList #-} --- | A synonym for 'Data.Functor.fmap'.+-- | A synonym for 'fmap'. -----   @map = 'Data.Functor.fmap'@-map :: Data.Functor.Functor f => (a -> b) -> f a -> f b-map = Data.Functor.fmap+--   @map = 'fmap'@+map :: Functor f => (a -> b) -> f a -> f b+map = fmap {-# INLINE map #-}  -- | Convert a value to a readable string type supported by 'ConvertibleStrings' using the 'Show' instance.-show :: (Show a, ConvertibleStrings String b) => a -> b-show = convertString . showS+show :: (Show a, IsString s) => a -> s+show = fromString . showS {-# INLINE show #-}  -- | Convert a value to a readable 'Text' using the 'Show' instance.@@ -893,8 +896,8 @@ {-# WARNING undefined "'undefined' remains in code" #-}  -- | '<>' lifted to 'Control.Applicative.Applicative'-(<>^) :: (Control.Applicative.Applicative f, Data.Semigroup.Semigroup a) => f a -> f a -> f a-(<>^) = Control.Applicative.liftA2 (Data.Semigroup.<>)+(<>^) :: (Control.Applicative.Applicative f, Semigroup a) => f a -> f a -> f a+(<>^) = Control.Applicative.liftA2 (<>) infixr 6 <>^ {-# INLINE (<>^) #-} @@ -930,3 +933,34 @@   "Panic: " <> msg <> "\n\n" <>   "Please submit a bug report including the stacktrace\n" <>   "and a description on how to reproduce the bug."++-- | Monad fail function from the 'Control.Monad.Fail.MonadFail' class.+--+-- When a value is bound in @do@-notation, the pattern on the left+-- hand side of @<-@ might not match. In this case, this class+-- provides a function to recover.+--+-- A 'Monad' without a 'MonadFail' instance may only be used in conjunction+-- with pattern that always match, such as newtypes, tuples, data types with+-- only a single data constructor, and irrefutable patterns (@~pat@).+--+-- Instances of 'MonadFail' should satisfy the following law: @fail s@ should+-- be a left zero for '>>=',+--+-- @+-- fail s >>= f  =  fail s+-- @+--+-- If your 'Monad' is also 'MonadPlus', a popular definition is+--+-- @+-- fail _ = mzero+-- @+#if MIN_VERSION_base(4,9,0)+fail :: Control.Monad.Fail.MonadFail m => Text -> m a+fail = Control.Monad.Fail.fail . convertString+#else+fail :: Control.Monad.Monad m => Text -> m a+fail = Control.Monad.fail . convertString+#endif+{-# INLINE fail #-}
src/Intro/Trustworthy.hs view
@@ -38,10 +38,9 @@  import Control.Monad.Trans (MonadIO(liftIO)) import Data.Function ((.))-import Data.Text (Text)+import Data.Text (Text, unpack) import Text.Show (Show) import qualified Data.DList-import qualified Data.Text import qualified Debug.Trace import qualified GHC.Exts import qualified Data.Hashable.Lifted@@ -70,7 +69,7 @@ -- that it is a pure function but it has the side effect of outputting the -- trace message. trace :: Text -> a -> a-trace = Debug.Trace.trace . Data.Text.unpack+trace = Debug.Trace.trace . unpack {-# WARNING trace "'trace' remains in code" #-}  -- | Like 'trace' but returning unit in an arbitrary 'Applicative' context. Allows@@ -89,7 +88,7 @@ -- >   y <- ... -- >   traceM $ "y: " ++ show y traceM :: APPLICATIVE m => Text -> m ()-traceM = Debug.Trace.traceM . Data.Text.unpack+traceM = Debug.Trace.traceM . unpack {-# WARNING traceM "'traceM' remains in code" #-}  -- | Like 'trace', but uses 'show' on the argument to convert it to a 'String'.@@ -121,5 +120,5 @@ -- | The 'traceIO' function outputs the trace message from the IO monad. -- This sequences the output with respect to other IO actions. traceIO :: MonadIO m => Text -> m ()-traceIO = liftIO . Debug.Trace.traceIO . Data.Text.unpack+traceIO = liftIO . Debug.Trace.traceIO . unpack {-# WARNING traceIO "'traceIO' remains in code" #-}
test/BaseCompat.hs view
@@ -79,6 +79,6 @@ import Unsafe.Coerce as X  #if MIN_VERSION_base(4,9,0)-import Control.Monad.Fail as X+import Control.Monad.Fail as X hiding (fail) import Data.Kind as X #endif