packages feed

intro 0.1.0.1 → 0.1.0.2

raw patch · 3 files changed

+14/−27 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Intro: traceStack :: Text -> a -> a
- Intro: traceStackM :: Applicative m => Text -> m ()
+ Intro: (?:) :: Maybe a -> a -> a
+ Intro: class Generic1 (f :: * -> *)
+ Intro: infix 1 ?:

Files

intro.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack  name:           intro-version:        0.1.0.1+version:        0.1.0.2 synopsis:       "Fixed Prelude" - Mostly total and safe, provides Text and Monad transformers description:    Modern Prelude which provides safe alternatives for most of the partial functions. Text is preferred over String. Container types and Monad transformers are provided. Most important - this Prelude avoids fanciness. This means it just reexports from base and commonly used libraries and doesn\'t invent its own stuff. Everything is in one file. category:       Prelude
src/Intro.hs view
@@ -84,6 +84,7 @@   , Data.Maybe.Maybe(Nothing, Just)   , Data.Maybe.catMaybes   , Data.Maybe.fromMaybe+  , (?:)   , Data.Maybe.isJust   , Data.Maybe.isNothing   --, Data.Maybe.listToMaybe -- use headMay@@ -558,6 +559,7 @@    -- * Generic type classes   , GHC.Generics.Generic+  , GHC.Generics.Generic1   , Data.Typeable.Typeable   , Control.DeepSeq.NFData   , Data.Binary.Binary@@ -602,10 +604,9 @@   , Intro.Trustworthy.traceM   , Intro.Trustworthy.traceShow   , Intro.Trustworthy.traceShowM-  , Intro.Trustworthy.traceStack-  , Intro.Trustworthy.traceStackM ) where +import Data.Maybe (Maybe, fromMaybe) import Data.Function ((.), ($)) import Control.Monad.Trans (MonadIO(liftIO)) import Data.ByteString (ByteString)@@ -720,7 +721,7 @@  -- | Parse a string type using the 'Text.Read.Read' instance. -- Succeeds if there is exactly one valid result.-readMaybe :: (Text.Read.Read b, ConvertibleStrings a String) => a -> Data.Maybe.Maybe b+readMaybe :: (Text.Read.Read b, ConvertibleStrings a String) => a -> Maybe b readMaybe = Text.Read.readMaybe . convertString {-# INLINE readMaybe #-} @@ -843,6 +844,12 @@ infixr 8 .: {-# INLINE (.:) #-} +-- | An infix form of 'fromMaybe' with arguments flipped.+(?:) :: Maybe a -> a -> a+(?:) = Data.Function.flip fromMaybe+infix 1 ?:+{-# INLINE (?:) #-}+ -- | @()@ lifted to an 'Control.Applicative.Applicative'. -- --   @skip = 'Control.Applicative.pure' ()@@@ -854,7 +861,7 @@ -- of a logic error at runtime. Use this function instead of 'Prelude.error'. -- A stack trace will be provided. ----- In general, prefer total functions. You can use 'Data.Maybe.Maybe', 'Data.Either.Either',+-- In general, prefer total functions. You can use 'Maybe', 'Data.Either.Either', -- 'Control.Monad.Except.ExceptT' or 'Control.Monad.Except.MonadError' for error handling. panic :: HAS_CALL_STACK String -> a panic msg = Prelude.error $
src/Intro/Trustworthy.hs view
@@ -28,13 +28,11 @@   , traceM   , traceShow   , traceShowM-  , traceStack-  , traceStackM ) where -import Control.Applicative (Applicative(pure))+import Control.Applicative (Applicative) import Control.Monad.Trans (MonadIO(liftIO))-import Data.Function ((.), ($))+import Data.Function ((.)) import Data.Text (Text) import Text.Show (Show) import qualified Data.DList@@ -82,24 +80,6 @@ traceM :: APPLICATIVE m => Text -> m () traceM = Debug.Trace.traceM . Data.Text.unpack {-# WARNING traceM "'traceM' remains in code" #-}---- | like 'trace', but additionally prints a call stack if one is--- available.------ In the current GHC implementation, the call stack is only--- available if the program was compiled with @-prof@; otherwise--- 'traceStack' behaves exactly like 'trace'.  Entries in the call--- stack correspond to @SCC@ annotations, so it is a good idea to use--- @-fprof-auto@ or @-fprof-auto-calls@ to add SCC annotations automatically.-traceStack :: Text -> a -> a-traceStack = Debug.Trace.traceStack . Data.Text.unpack-{-# WARNING traceStack "'traceStack' remains in code" #-}---- | Like 'traceStack' but returning unit in an arbitrary 'Applicative' context. Allows--- for convenient use in do-notation.-traceStackM :: APPLICATIVE m => Text -> m ()-traceStackM s = traceStack s $ pure ()-{-# WARNING traceStackM "'traceStackM' remains in code" #-}  -- | Like 'trace', but uses 'show' on the argument to convert it to a 'String'. --