intro 0.1.0.5 → 0.1.0.6
raw patch · 4 files changed
+28/−22 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Intro: class Monad m => MonadFix (m :: * -> *)
+ Intro: mfix :: MonadFix m => (a -> m a) -> m a
- Intro: panic :: HasCallStack => String -> a
+ Intro: panic :: HasCallStack => Text -> a
Files
- README.md +2/−4
- intro.cabal +3/−2
- src/Intro.hs +13/−14
- src/Intro/Trustworthy.hs +10/−2
README.md view
@@ -11,9 +11,7 @@ Most important - this Prelude tries to keep things simple. This means it just reexports from base and commonly used libraries-and doesn't invent its own stuff.-Furthermore the Prelude is not scattered over many files.-Everything is exported explicitly to improve the quality of the documentation.+and doesn't invent its own stuff. Furthermore the Prelude is not scattered over many files. List of design decisions: @@ -21,7 +19,7 @@ * Conservative extension over the base Prelude * Rely only on very common external libraries * Avoid writing custom functions-* Export everything explicitly for good documentation+* Export everything explicitly to provide a stable interface and for good documentation * Export only total functions or provide safe alternatives (Very few exceptions like div etc.) * Prefer Text over String, provide ConvertibleStrings * Provide Monad transformers
intro.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: intro-version: 0.1.0.5+version: 0.1.0.6 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@@ -15,7 +15,8 @@ This means it just reexports from base and commonly used libraries and doesn\'t invent its own stuff. Furthermore the Prelude is not scattered over many files.- Everything is exported explicitly to improve the quality of the documentation.+ Everything is exported explicitly to provide a stable interface+ and to improve the quality of the documentation. category: Prelude stability: experimental homepage: https://github.com/minad/intro#readme
src/Intro.hs view
@@ -1,8 +1,9 @@ {-# OPTIONS_HADDOCK show-extensions #-}-{-# LANGUAGE Safe #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NoImplicitPrelude #-}-{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE Safe #-} ----------------------------------------------------------------------------- -- |@@ -24,7 +25,6 @@ -- This means it just reexports from base and commonly used libraries -- and doesn\'t invent its own stuff. -- Furthermore the Prelude is not scattered over many files.--- Everything is exported explicitly to improve the quality of the documentation. -- -- List of design decisions: --@@ -32,7 +32,7 @@ -- * Conservative extension over the base Prelude -- * Rely only on very common external libraries -- * Avoid writing custom functions--- * Export everything explicitly for good documentation+-- * Export everything explicitly to provide a stable interface and for good documentation -- * Export only total functions or provide safe alternatives (Very few exceptions like div etc.) -- * Prefer Text over String, provide ConvertibleStrings -- * Provide Monad transformers@@ -474,6 +474,7 @@ #else , Control.Monad.Monad((>>=), fail) #endif+ , Control.Monad.Fix.MonadFix(mfix) , (Control.Monad.=<<) , (Control.Monad.<=<) , (Control.Monad.>=>)@@ -597,8 +598,8 @@ -- * Type level #if MIN_VERSION_base(4,9,0) , Data.Kind.Type- , Data.Kind.Constraint #endif+ , Intro.Trustworthy.Constraint , Data.Proxy.Proxy(Proxy) , Data.Tagged.Tagged(Tagged) , Data.Tagged.unTagged@@ -636,13 +637,14 @@ , Intro.Trustworthy.traceShowM ) where -import Data.Maybe (Maybe, fromMaybe)-import Data.Function ((.), ($)) import Control.Monad.Trans (MonadIO(liftIO)) import Data.ByteString (ByteString)+import Data.Function ((.), ($))+import Data.Maybe (Maybe, fromMaybe) import Data.Semigroup ((<>)) import Data.String.Conversions (ConvertibleStrings(convertString)) import Data.Text (Text)+import Intro.Trustworthy (HasCallStack) import Prelude (String, Char, FilePath, Show) import qualified Control.Applicative import qualified Control.Category@@ -650,6 +652,7 @@ import qualified Control.Monad import qualified Control.Monad.Except import qualified Control.Monad.Extra+import qualified Control.Monad.Fix import qualified Control.Monad.RWS.CPS import qualified Control.Monad.Reader import qualified Control.Monad.State.Strict@@ -712,10 +715,6 @@ import qualified Control.Monad.Fail import qualified Data.Functor.Classes import qualified Data.Kind-import qualified GHC.Stack.Types-#define HAS_CALL_STACK GHC.Stack.Types.HasCallStack =>-#else-#define HAS_CALL_STACK #endif -- | Alias for lazy 'Data.Text.Lazy.Text'@@ -848,7 +847,7 @@ {-# INLINE appendFileUtf8 #-} -- | Throw an undefined error. Use only for debugging.-undefined :: HAS_CALL_STACK a+undefined :: HasCallStack => a undefined = Prelude.undefined {-# WARNING undefined "'undefined' remains in code" #-} @@ -885,8 +884,8 @@ -- -- 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 $+panic :: HasCallStack => Text -> a+panic msg = Prelude.error $ convertString $ "Panic: " <> msg <> "\n\n" <> "Please submit a bug report including the stacktrace\n" <> "and a description on how to reproduce the bug."
src/Intro/Trustworthy.hs view
@@ -1,6 +1,8 @@-{-# LANGUAGE Trustworthy #-}-{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE CPP #-}+{-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE KindSignatures #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- -- |@@ -23,6 +25,8 @@ , fromList -- , toList -- provided by Foldable )+ , Constraint+ , HasCallStack , trace , traceIO , traceM@@ -44,9 +48,13 @@ #if MIN_VERSION_base(4,9,0) import Control.Applicative (Applicative)+import Data.Kind (Constraint)+import GHC.Stack (HasCallStack) #define APPLICATIVE Applicative #else import Control.Monad (Monad)+import GHC.Exts (Constraint)+type HasCallStack = (() :: GHC.Exts.Constraint) #define APPLICATIVE Monad #endif