intro 0.2.0.2 → 0.3.0.0
raw patch · 9 files changed
+99/−111 lines, 9 filesdep −aesondep −asyncdep −attoparsecPVP ok
version bump matches the API change (PVP)
Dependencies removed: aeson, async, attoparsec, cassava, contravariant, filepath, megaparsec, profunctors, quickcheck-instances, tagged
API changes (from Hackage documentation)
- Intro: Tagged :: b -> Tagged k b
- Intro: [unTagged] :: Tagged k b -> b
- Intro: newtype Tagged k (s :: k) b :: forall k. k -> * -> *
- Intro: unTagged :: Tagged k s b -> b
+ Intro: data ShortByteString :: *
+ Intro: traceId :: Text -> Text
+ Intro: traceShowId :: Show a => a -> a
Files
- intro.cabal +12/−21
- src/Intro.hs +18/−17
- src/Intro/Trustworthy.hs +12/−0
- test/AesonCompat.hs +0/−7
- test/AttoparsecCompat.hs +0/−7
- test/LensCompat.hs +4/−0
- test/LibCompat.hs +0/−11
- test/MegaparsecCompat.hs +0/−8
- test/test.hs +53/−40
intro.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: intro-version: 0.2.0.2+version: 0.3.0.0 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@@ -25,7 +25,7 @@ copyright: 2016-2017 Daniel Mendler license: MIT license-file: LICENSE-tested-with: GHC == 7.10.3, GHC == 8.0.1+tested-with: GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.1 build-type: Simple cabal-version: >= 1.10 @@ -42,7 +42,6 @@ ghc-options: -Wall build-depends: base >= 4.8 && < 5.0- , bifunctors >= 5.2 && < 5.5 , binary >= 0.7 && < 0.9 , bytestring >= 0.9 && < 0.11 , containers >= 0.5 && < 0.6@@ -52,7 +51,6 @@ , hashable >= 1.2.5 && < 1.3 , mtl >= 2.2 && < 2.3 , safe >= 0.3.11 && < 0.4- , tagged >= 0.8 && < 0.9 , text >= 0.7 && < 1.3 , transformers >= 0.4 && < 0.6 , unordered-containers >= 0.2 && < 0.3@@ -60,6 +58,9 @@ if impl(ghc < 8.0) build-depends: semigroups >= 0.9 && < 1+ if impl(ghc < 8.1)+ build-depends:+ bifunctors >= 5.2 && < 5.5 exposed-modules: Intro other-modules:@@ -76,7 +77,6 @@ ghc-options: -Wall build-depends: base >= 4.8 && < 5.0- , bifunctors >= 5.2 && < 5.5 , binary >= 0.7 && < 0.9 , bytestring >= 0.9 && < 0.11 , containers >= 0.5 && < 0.6@@ -86,31 +86,22 @@ , hashable >= 1.2.5 && < 1.3 , mtl >= 2.2 && < 2.3 , safe >= 0.3.11 && < 0.4- , tagged >= 0.8 && < 0.9 , text >= 0.7 && < 1.3 , transformers >= 0.4 && < 0.6 , unordered-containers >= 0.2 && < 0.3 , writer-cps-mtl >= 0.1.1.2 && < 0.2- , QuickCheck- , aeson- , async- , attoparsec- , cassava- , contravariant- , filepath , intro- , lens- , megaparsec- , profunctors- , quickcheck-instances+ , QuickCheck if impl(ghc < 8.0) build-depends: semigroups >= 0.9 && < 1+ if impl(ghc < 8.1)+ build-depends:+ bifunctors >= 5.2 && < 5.5+ if impl(ghc < 8.1)+ build-depends:+ lens other-modules:- AesonCompat- AttoparsecCompat BaseCompat LensCompat- LibCompat- MegaparsecCompat default-language: Haskell2010
src/Intro.hs view
@@ -241,8 +241,9 @@ -- ** ByteString , Data.ByteString.ByteString , LByteString+ , Data.ByteString.Short.ShortByteString - -- ** Conversion+ -- ** String conversion , Data.String.IsString(fromString) , Intro.ConvertString.ConvertString(convertString) , Intro.ConvertString.EncodeString(encodeString, decodeString, decodeStringLenient)@@ -263,11 +264,9 @@ , Intro.Trustworthy.Hashable1 , Intro.Trustworthy.Hashable2 - -- ** Seq- , Data.Sequence.Seq-- -- ** DList+ -- ** DList and Seq , Intro.Trustworthy.DList+ , Data.Sequence.Seq -- * Numeric types @@ -364,7 +363,7 @@ #endif , readMaybe - -- * Equality and Ordering+ -- * Equality and ordering -- ** Eq , Data.Eq.Eq((==), (/=))@@ -494,15 +493,10 @@ -- ** Monad , Control.Monad.Monad((>>=))-#if MIN_VERSION_base(4,9,0)- , Control.Monad.Fail.MonadFail-#endif- , fail , Control.Monad.Fix.MonadFix(mfix) , (Control.Monad.=<<) , (Control.Monad.<=<) , (Control.Monad.>=>)- , Control.Monad.MonadPlus , Control.Monad.join , Control.Monad.guard , Control.Monad.when@@ -539,10 +533,11 @@ , Data.Bitraversable.bifor , Data.Bitraversable.bisequenceA - -- * Monad transformer+ -- * Effects and monad transformers , Control.Monad.Trans.MonadTrans(lift) - -- ** MaybeT+ -- ** MonadPlus and MaybeT+ , Control.Monad.MonadPlus , Control.Monad.Trans.Maybe.MaybeT(MaybeT, runMaybeT) , Control.Monad.Trans.Maybe.mapMaybeT @@ -625,8 +620,8 @@ #endif , Intro.Trustworthy.Constraint , Data.Proxy.Proxy(Proxy)- , Data.Tagged.Tagged(Tagged)- , Data.Tagged.unTagged+ --, Data.Tagged.Tagged(Tagged)+ --, Data.Tagged.unTagged -- * IO , System.IO.IO@@ -651,13 +646,19 @@ , writeFileUtf8 , appendFileUtf8 - -- * Error and Debugging+ -- * Error handling and debugging+#if MIN_VERSION_base(4,9,0)+ , Control.Monad.Fail.MonadFail+#endif+ , fail , panic , undefined , Intro.Trustworthy.trace , Intro.Trustworthy.traceIO+ , Intro.Trustworthy.traceId , Intro.Trustworthy.traceM , Intro.Trustworthy.traceShow+ , Intro.Trustworthy.traceShowId , Intro.Trustworthy.traceShowM ) where @@ -695,6 +696,7 @@ import qualified Data.Bool import qualified Data.ByteString import qualified Data.ByteString.Lazy+import qualified Data.ByteString.Short import qualified Data.Either import qualified Data.Either.Extra import qualified Data.Eq@@ -720,7 +722,6 @@ import qualified Data.Semigroup import qualified Data.Sequence import qualified Data.Set-import qualified Data.Tagged import qualified Data.Text.IO import qualified Data.Text.Lazy import qualified Data.Traversable
src/Intro/Trustworthy.hs view
@@ -29,8 +29,10 @@ , HasCallStack , trace , traceIO+ , traceId , traceM , traceShow+ , traceShowId , traceShowM , Data.Hashable.Lifted.Hashable1 , Data.Hashable.Lifted.Hashable2@@ -122,3 +124,13 @@ traceIO :: MonadIO m => Text -> m () traceIO = liftIO . Debug.Trace.traceIO . unpack {-# WARNING traceIO "'traceIO' remains in code" #-}++-- | Like 'traceShow' but returns the shown value instead of a third value.+traceShowId :: Show a => a -> a+traceShowId = Debug.Trace.traceShowId+{-# WARNING traceShowId "'traceShowId' remains in code" #-}++-- | Like 'trace' but returns the message instead of a third value.+traceId :: Text -> Text+traceId a = Debug.Trace.trace (unpack a) a+{-# WARNING traceId "'traceId' remains in code" #-}
− test/AesonCompat.hs
@@ -1,7 +0,0 @@-{-# LANGUAGE NoImplicitPrelude #-}-module AesonCompat (- module X-) where--import Intro as X-import Data.Aeson as X hiding ((.:))
− test/AttoparsecCompat.hs
@@ -1,7 +0,0 @@-{-# LANGUAGE NoImplicitPrelude #-}-module AttoparsecCompat (- module X-) where--import Intro as X-import Data.Attoparsec.ByteString as X hiding (take, skip, takeWhile)
test/LensCompat.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE CPP #-} module LensCompat ( module X ) where import Intro as X++#if __GLASGOW_HASKELL__ < 820 import Control.Lens as X+#endif
− test/LibCompat.hs
@@ -1,11 +0,0 @@-{-# LANGUAGE NoImplicitPrelude #-}-module LibCompat (- module X-) where--import Control.Concurrent.Async as X-import Data.Functor.Contravariant as X-import Data.Csv as X hiding (lookup, (.:))-import Data.Profunctor as X-import Intro as X-import System.FilePath as X
− test/MegaparsecCompat.hs
@@ -1,8 +0,0 @@-{-# LANGUAGE NoImplicitPrelude #-}-module MegaparsecCompat (- module X-) where--import Intro as X-import Text.Megaparsec.Text as X-import Text.Megaparsec.Lexer as X
test/test.hs view
@@ -5,54 +5,67 @@ {-# LANGUAGE ScopedTypeVariables #-} module Main where +import BaseCompat () import Data.ByteString.Short (ShortByteString) import Intro-import LibCompat () import LensCompat ()-import AesonCompat ()-import AttoparsecCompat ()-import MegaparsecCompat () import Test.QuickCheck-import Test.QuickCheck.Instances ()+import qualified Data.ByteString as B+import qualified Data.ByteString.Lazy as LB+import qualified Data.ByteString.Short as SB+import qualified Data.Text as T+import qualified Data.Text.Lazy as LT +instance Arbitrary ByteString where arbitrary = B.pack <$> arbitrary+instance Arbitrary LB.ByteString where arbitrary = LB.pack <$> arbitrary+instance Arbitrary ShortByteString where arbitrary = SB.pack <$> arbitrary+instance Arbitrary Text where arbitrary = T.pack <$> arbitrary+instance Arbitrary LT.Text where arbitrary = LT.pack <$> arbitrary+ main :: IO () main = do- encode (Proxy :: Proxy LText) (Proxy :: Proxy ByteString)- encode (Proxy :: Proxy LText) (Proxy :: Proxy LByteString)- encode (Proxy :: Proxy LText) (Proxy :: Proxy ShortByteString)- encode (Proxy :: Proxy LText) (Proxy :: Proxy [Word8])- encode (Proxy :: Proxy String) (Proxy :: Proxy ByteString)- encode (Proxy :: Proxy String) (Proxy :: Proxy LByteString)- encode (Proxy :: Proxy String) (Proxy :: Proxy ShortByteString)- encode (Proxy :: Proxy String) (Proxy :: Proxy [Word8])- encode (Proxy :: Proxy Text) (Proxy :: Proxy ByteString)- encode (Proxy :: Proxy Text) (Proxy :: Proxy LByteString)- encode (Proxy :: Proxy Text) (Proxy :: Proxy ShortByteString)- encode (Proxy :: Proxy Text) (Proxy :: Proxy [Word8])- iso (Proxy :: Proxy ByteString) (Proxy :: Proxy ByteString)- iso (Proxy :: Proxy ByteString) (Proxy :: Proxy LByteString)- iso (Proxy :: Proxy ByteString) (Proxy :: Proxy ShortByteString)- iso (Proxy :: Proxy ByteString) (Proxy :: Proxy [Word8])- iso (Proxy :: Proxy LByteString) (Proxy :: Proxy ByteString)- iso (Proxy :: Proxy LByteString) (Proxy :: Proxy LByteString)- iso (Proxy :: Proxy LByteString) (Proxy :: Proxy ShortByteString)- iso (Proxy :: Proxy LByteString) (Proxy :: Proxy [Word8])- iso (Proxy :: Proxy LText) (Proxy :: Proxy LText)- iso (Proxy :: Proxy LText) (Proxy :: Proxy String)- iso (Proxy :: Proxy LText) (Proxy :: Proxy Text)- iso (Proxy :: Proxy String) (Proxy :: Proxy LText)- iso (Proxy :: Proxy String) (Proxy :: Proxy String)- iso (Proxy :: Proxy String) (Proxy :: Proxy Text)- iso (Proxy :: Proxy Text) (Proxy :: Proxy LText)- iso (Proxy :: Proxy Text) (Proxy :: Proxy String)- iso (Proxy :: Proxy Text) (Proxy :: Proxy Text)- iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy ByteString)- iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy LByteString)- iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy ShortByteString)- iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy [Word8])+ encode (Proxy :: Proxy LText) (Proxy :: Proxy ByteString)+ encode (Proxy :: Proxy LText) (Proxy :: Proxy LByteString)+ encode (Proxy :: Proxy LText) (Proxy :: Proxy ShortByteString)+ encode (Proxy :: Proxy LText) (Proxy :: Proxy [Word8])+ encode (Proxy :: Proxy String) (Proxy :: Proxy ByteString)+ encode (Proxy :: Proxy String) (Proxy :: Proxy LByteString)+ encode (Proxy :: Proxy String) (Proxy :: Proxy ShortByteString)+ encode (Proxy :: Proxy String) (Proxy :: Proxy [Word8])+ encode (Proxy :: Proxy Text) (Proxy :: Proxy ByteString)+ encode (Proxy :: Proxy Text) (Proxy :: Proxy LByteString)+ encode (Proxy :: Proxy Text) (Proxy :: Proxy ShortByteString)+ encode (Proxy :: Proxy Text) (Proxy :: Proxy [Word8])+ iso (Proxy :: Proxy ByteString) (Proxy :: Proxy ByteString)+ iso (Proxy :: Proxy ByteString) (Proxy :: Proxy LByteString)+ iso (Proxy :: Proxy ByteString) (Proxy :: Proxy ShortByteString)+ iso (Proxy :: Proxy ByteString) (Proxy :: Proxy [Word8])+ iso (Proxy :: Proxy ShortByteString) (Proxy :: Proxy ByteString)+ iso (Proxy :: Proxy ShortByteString) (Proxy :: Proxy LByteString)+ iso (Proxy :: Proxy ShortByteString) (Proxy :: Proxy ShortByteString)+ iso (Proxy :: Proxy ShortByteString) (Proxy :: Proxy [Word8])+ iso (Proxy :: Proxy LByteString) (Proxy :: Proxy ByteString)+ iso (Proxy :: Proxy LByteString) (Proxy :: Proxy LByteString)+ iso (Proxy :: Proxy LByteString) (Proxy :: Proxy ShortByteString)+ iso (Proxy :: Proxy LByteString) (Proxy :: Proxy [Word8])+ iso (Proxy :: Proxy LText) (Proxy :: Proxy LText)+ iso (Proxy :: Proxy LText) (Proxy :: Proxy String)+ iso (Proxy :: Proxy LText) (Proxy :: Proxy Text)+ iso (Proxy :: Proxy String) (Proxy :: Proxy LText)+ iso (Proxy :: Proxy String) (Proxy :: Proxy String)+ iso (Proxy :: Proxy String) (Proxy :: Proxy Text)+ iso (Proxy :: Proxy Text) (Proxy :: Proxy LText)+ iso (Proxy :: Proxy Text) (Proxy :: Proxy String)+ iso (Proxy :: Proxy Text) (Proxy :: Proxy Text)+ iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy ByteString)+ iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy LByteString)+ iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy ShortByteString)+ iso (Proxy :: Proxy [Word8]) (Proxy :: Proxy [Word8]) -iso :: forall a b proxy. (Eq a, Show a, Arbitrary a, ConvertString a b, ConvertString b a) => proxy a -> proxy b -> IO ()-iso _ _ = quickCheck $ \(a :: a) -> convertString (convertString a :: b) == a+iso :: forall a b proxy. (Eq a, Eq b, Show a, Show b, Arbitrary a, Arbitrary b, ConvertString a b, ConvertString b a) => proxy a -> proxy b -> IO ()+iso _ _ = do+ quickCheck $ \(a :: a) -> convertString (convertString a :: b) == a+ quickCheck $ \(b :: b) -> convertString (convertString b :: a) == b encode :: forall a b proxy. (Eq a, Show a, Arbitrary a, EncodeString a b) => proxy a -> proxy b -> IO () encode _ _ = do