Hello community, here is the log from the commit of package ghc-intro for openSUSE:Factory checked in at 2017-08-31 20:56:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-intro (Old) and /work/SRC/openSUSE:Factory/.ghc-intro.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-intro" Thu Aug 31 20:56:42 2017 rev:3 rq:513405 version:0.3.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-intro/ghc-intro.changes 2017-05-03 15:56:11.320708681 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-intro.new/ghc-intro.changes 2017-08-31 20:56:43.401225877 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:03:05 UTC 2017 - [email protected] + +- Update to version 0.3.0.1. + +------------------------------------------------------------------- Old: ---- intro-0.1.0.10.tar.gz New: ---- intro-0.3.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-intro.spec ++++++ --- /var/tmp/diff_new_pack.Eb4SrP/_old 2017-08-31 20:56:44.201113490 +0200 +++ /var/tmp/diff_new_pack.Eb4SrP/_new 2017-08-31 20:56:44.205112928 +0200 @@ -19,7 +19,7 @@ %global pkg_name intro %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.1.0.10 +Version: 0.3.0.1 Release: 0 Summary: "Fixed Prelude" - Mostly total and safe, provides Text and Monad transformers License: MIT @@ -38,14 +38,13 @@ BuildRequires: ghc-mtl-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-safe-devel -BuildRequires: ghc-string-conversions-devel -BuildRequires: ghc-tagged-devel BuildRequires: ghc-text-devel BuildRequires: ghc-transformers-devel BuildRequires: ghc-unordered-containers-devel BuildRequires: ghc-writer-cps-mtl-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build %if %{with tests} +BuildRequires: ghc-QuickCheck-devel BuildRequires: ghc-lens-devel %endif ++++++ intro-0.1.0.10.tar.gz -> intro-0.3.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/LICENSE new/intro-0.3.0.1/LICENSE --- old/intro-0.1.0.10/LICENSE 2017-02-04 15:07:23.000000000 +0100 +++ new/intro-0.3.0.1/LICENSE 2017-03-07 03:08:15.000000000 +0100 @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Daniel Mendler +Copyright (c) 2016-2017 Daniel Mendler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/README.md new/intro-0.3.0.1/README.md --- old/intro-0.1.0.10/README.md 2017-02-14 16:42:53.000000000 +0100 +++ new/intro-0.3.0.1/README.md 2017-04-05 10:15:15.000000000 +0200 @@ -15,16 +15,16 @@ List of design decisions: -* Keep everything at one place (There are one two modules and Intro.Trustworthy is only there for Safe Haskell) +* Keep everything at one place (There are three modules and Intro.Trustworthy is only there for Safe Haskell) * Conservative extension over the base Prelude * Rely only on very common external libraries * Avoid writing custom functions * 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 +* Prefer Text over String, provide ConvertString and EncodeString * Provide Monad transformers * Provide container types * Prefer generic functions * Debugging functions, like 'Intro.Trustworthy.trace' and 'undefined' are available but produce compile time warnings * Don't provide error, only panic instead -* Compatibility with Control.Lens +* Compatibility with unqualified import of Control.Lens diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/intro.cabal new/intro-0.3.0.1/intro.cabal --- old/intro-0.1.0.10/intro.cabal 2017-03-03 06:18:06.000000000 +0100 +++ new/intro-0.3.0.1/intro.cabal 2017-06-18 10:57:22.000000000 +0200 @@ -1,9 +1,9 @@ --- This file has been generated from package.yaml by hpack version 0.15.0. +-- This file has been generated from package.yaml by hpack version 0.17.0. -- -- see: https://github.com/sol/hpack name: intro -version: 0.1.0.10 +version: 0.3.0.1 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 @@ -22,10 +22,10 @@ bug-reports: https://github.com/minad/intro/issues author: Daniel Mendler <[email protected]> maintainer: Daniel Mendler <[email protected]> -copyright: 2016 Daniel Mendler +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,18 +42,15 @@ 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 , deepseq >= 1.4 && < 1.5 , dlist >= 0.7 && < 0.9 - , extra >= 1.5.1 && < 1.6 + , extra >= 1.5.1 && < 1.7 , hashable >= 1.2.5 && < 1.3 , mtl >= 2.2 && < 2.3 , safe >= 0.3.11 && < 0.4 - , string-conversions >= 0.4 && < 0.5 - , tagged >= 0.8 && < 0.9 , text >= 0.7 && < 1.3 , transformers >= 0.4 && < 0.6 , unordered-containers >= 0.2 && < 0.3 @@ -61,42 +58,47 @@ 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: + Intro.ConvertString Intro.Trustworthy Paths_intro default-language: Haskell2010 -test-suite compat +test-suite test type: exitcode-stdio-1.0 - main-is: compat.hs + main-is: test.hs hs-source-dirs: test 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 , deepseq >= 1.4 && < 1.5 , dlist >= 0.7 && < 0.9 - , extra >= 1.5.1 && < 1.6 + , extra >= 1.5.1 && < 1.7 , hashable >= 1.2.5 && < 1.3 , mtl >= 2.2 && < 2.3 , safe >= 0.3.11 && < 0.4 - , string-conversions >= 0.4 && < 0.5 - , 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 , intro + , QuickCheck , lens if impl(ghc < 8.0) build-depends: semigroups >= 0.9 && < 1 + if impl(ghc < 8.1) + build-depends: + bifunctors >= 5.2 && < 5.5 other-modules: BaseCompat LensCompat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/src/Intro/ConvertString.hs new/intro-0.3.0.1/src/Intro/ConvertString.hs --- old/intro-0.1.0.10/src/Intro/ConvertString.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/intro-0.3.0.1/src/Intro/ConvertString.hs 2017-03-22 16:48:46.000000000 +0100 @@ -0,0 +1,176 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Intro.ConvertString +-- Copyright : (c) Daniel Mendler 2017 +-- License : MIT +-- +-- Maintainer : [email protected] +-- Stability : experimental +-- Portability : portable +-- +-- String conversion and decoding +-- +----------------------------------------------------------------------------- + +{-# LANGUAGE DeriveFoldable #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE Safe #-} + +module Intro.ConvertString ( + ConvertString(..) + , EncodeString(..) + , Lenient(..) +) where + +import Control.DeepSeq (NFData) +import Data.Binary (Binary) +import Data.ByteString (ByteString) +import Data.ByteString.Short (ShortByteString) +import Data.Either.Extra (eitherToMaybe) +import Data.Eq (Eq) +import Data.Foldable (Foldable) +import Data.Function (id, (.)) +import Data.Functor (Functor(fmap)) +import Data.Maybe (Maybe) +import Data.Ord (Ord) +import Data.String (String) +import Data.Text (Text) +import Data.Text.Encoding.Error (lenientDecode) +import Data.Traversable (Traversable) +import Data.Word (Word8) +import GHC.Generics (Generic, Generic1) +import Text.Read (Read) +import Text.Show (Show) +import qualified Data.ByteString as B +import qualified Data.ByteString.Lazy as BL +import qualified Data.ByteString.Short as S +import qualified Data.Text as T +import qualified Data.Text.Encoding as TE +import qualified Data.Text.Lazy as TL +import qualified Data.Text.Lazy.Encoding as TLE + +-- | Conversion of strings to other string types +-- +-- @ +-- ('convertString' :: b -> a) . ('convertString' :: a -> b) ≡ ('id' :: a -> a) +-- ('convertString' :: b -> 'Maybe' a) . ('convertString' :: a -> b) ≡ ('Just' :: a -> 'Maybe' a) +-- ('convertString' :: b -> 'Lenient' a) . ('convertString' :: a -> b) ≡ ('Lenient' :: a -> 'Lenient' a) +-- @ +class ConvertString a b where + -- | Convert a string to another string type + convertString :: a -> b + +-- | Encode and decode strings as a byte sequence +-- +-- @ +-- 'decodeString' . 'encodeString' ≡ 'Just' +-- 'decodeStringLenient' . 'encodeString' ≡ 'id' +-- @ +class (ConvertString a b, ConvertString b (Maybe a), ConvertString b (Lenient a)) => EncodeString a b where + -- | Encode a string as a byte sequence + encodeString :: a -> b + encodeString = convertString + {-# INLINE encodeString #-} + + -- | Lenient decoding of byte sequence + -- + -- Lenient means that invalid characters are replaced + -- by the Unicode replacement character '\FFFD'. + decodeStringLenient :: b -> a + decodeStringLenient = getLenient . convertString + {-# INLINE decodeStringLenient #-} + + -- | Decode byte sequence + -- + -- If the decoding fails, return Nothing. + decodeString :: b -> Maybe a + decodeString = convertString + {-# INLINE decodeString #-} + +-- | Newtype wrapper for a string which was decoded leniently. +newtype Lenient a = Lenient { getLenient :: a } + deriving (Eq, Ord, Read, Show, Functor, Foldable, Traversable, Generic, Generic1) + +instance Binary a => Binary (Lenient a) +instance NFData a => NFData (Lenient a) + +instance ConvertString BL.ByteString (Lenient String) where {-# INLINE convertString #-}; convertString = Lenient . TL.unpack . TLE.decodeUtf8With lenientDecode +instance ConvertString BL.ByteString (Lenient TL.Text) where {-# INLINE convertString #-}; convertString = Lenient . TLE.decodeUtf8With lenientDecode +instance ConvertString BL.ByteString (Lenient Text) where {-# INLINE convertString #-}; convertString = Lenient . TE.decodeUtf8With lenientDecode . BL.toStrict +instance ConvertString BL.ByteString (Maybe String) where {-# INLINE convertString #-}; convertString = fmap TL.unpack . eitherToMaybe . TLE.decodeUtf8' +instance ConvertString BL.ByteString (Maybe TL.Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TLE.decodeUtf8' +instance ConvertString BL.ByteString (Maybe Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TE.decodeUtf8' . BL.toStrict +instance ConvertString BL.ByteString BL.ByteString where {-# INLINE convertString #-}; convertString = id +instance ConvertString BL.ByteString ByteString where {-# INLINE convertString #-}; convertString = BL.toStrict +instance ConvertString BL.ByteString ShortByteString where {-# INLINE convertString #-}; convertString = S.toShort . BL.toStrict +instance ConvertString BL.ByteString [Word8] where {-# INLINE convertString #-}; convertString = BL.unpack +instance ConvertString ByteString (Lenient String) where {-# INLINE convertString #-}; convertString = Lenient . T.unpack . TE.decodeUtf8With lenientDecode +instance ConvertString ByteString (Lenient TL.Text) where {-# INLINE convertString #-}; convertString = Lenient . TLE.decodeUtf8With lenientDecode . BL.fromStrict +instance ConvertString ByteString (Lenient Text) where {-# INLINE convertString #-}; convertString = Lenient . TE.decodeUtf8With lenientDecode +instance ConvertString ByteString (Maybe String) where {-# INLINE convertString #-}; convertString = fmap T.unpack . eitherToMaybe . TE.decodeUtf8' +instance ConvertString ByteString (Maybe TL.Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TLE.decodeUtf8' . BL.fromStrict +instance ConvertString ByteString (Maybe Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TE.decodeUtf8' +instance ConvertString ByteString BL.ByteString where {-# INLINE convertString #-}; convertString = BL.fromStrict +instance ConvertString ByteString ByteString where {-# INLINE convertString #-}; convertString = id +instance ConvertString ByteString ShortByteString where {-# INLINE convertString #-}; convertString = S.toShort +instance ConvertString ByteString [Word8] where {-# INLINE convertString #-}; convertString = B.unpack +instance ConvertString ShortByteString (Lenient String) where {-# INLINE convertString #-}; convertString = Lenient . T.unpack . TE.decodeUtf8With lenientDecode . S.fromShort +instance ConvertString ShortByteString (Lenient TL.Text) where {-# INLINE convertString #-}; convertString = Lenient . TLE.decodeUtf8With lenientDecode . BL.fromStrict . S.fromShort +instance ConvertString ShortByteString (Lenient Text) where {-# INLINE convertString #-}; convertString = Lenient . TE.decodeUtf8With lenientDecode . S.fromShort +instance ConvertString ShortByteString (Maybe String) where {-# INLINE convertString #-}; convertString = fmap T.unpack . eitherToMaybe . TE.decodeUtf8' . S.fromShort +instance ConvertString ShortByteString (Maybe TL.Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TLE.decodeUtf8' . BL.fromStrict . S.fromShort +instance ConvertString ShortByteString (Maybe Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TE.decodeUtf8' . S.fromShort +instance ConvertString ShortByteString BL.ByteString where {-# INLINE convertString #-}; convertString = BL.fromStrict . S.fromShort +instance ConvertString ShortByteString ByteString where {-# INLINE convertString #-}; convertString = S.fromShort +instance ConvertString ShortByteString ShortByteString where {-# INLINE convertString #-}; convertString = id +instance ConvertString ShortByteString [Word8] where {-# INLINE convertString #-}; convertString = S.unpack +instance ConvertString String BL.ByteString where {-# INLINE convertString #-}; convertString = TLE.encodeUtf8 . TL.pack +instance ConvertString String ByteString where {-# INLINE convertString #-}; convertString = TE.encodeUtf8 . T.pack +instance ConvertString String ShortByteString where {-# INLINE convertString #-}; convertString = S.toShort . TE.encodeUtf8 . T.pack +instance ConvertString String String where {-# INLINE convertString #-}; convertString = id +instance ConvertString String TL.Text where {-# INLINE convertString #-}; convertString = TL.pack +instance ConvertString String Text where {-# INLINE convertString #-}; convertString = T.pack +instance ConvertString String [Word8] where {-# INLINE convertString #-}; convertString = BL.unpack . TLE.encodeUtf8 . TL.pack +instance ConvertString TL.Text BL.ByteString where {-# INLINE convertString #-}; convertString = TLE.encodeUtf8 +instance ConvertString TL.Text ByteString where {-# INLINE convertString #-}; convertString = BL.toStrict . TLE.encodeUtf8 +instance ConvertString TL.Text ShortByteString where {-# INLINE convertString #-}; convertString = S.toShort . BL.toStrict . TLE.encodeUtf8 +instance ConvertString TL.Text String where {-# INLINE convertString #-}; convertString = TL.unpack +instance ConvertString TL.Text TL.Text where {-# INLINE convertString #-}; convertString = id +instance ConvertString TL.Text Text where {-# INLINE convertString #-}; convertString = TL.toStrict +instance ConvertString TL.Text [Word8] where {-# INLINE convertString #-}; convertString = BL.unpack . TLE.encodeUtf8 +instance ConvertString Text BL.ByteString where {-# INLINE convertString #-}; convertString = BL.fromStrict . TE.encodeUtf8 +instance ConvertString Text ByteString where {-# INLINE convertString #-}; convertString = TE.encodeUtf8 +instance ConvertString Text ShortByteString where {-# INLINE convertString #-}; convertString = S.toShort . TE.encodeUtf8 +instance ConvertString Text String where {-# INLINE convertString #-}; convertString = T.unpack +instance ConvertString Text TL.Text where {-# INLINE convertString #-}; convertString = TL.fromStrict +instance ConvertString Text Text where {-# INLINE convertString #-}; convertString = id +instance ConvertString Text [Word8] where {-# INLINE convertString #-}; convertString = BL.unpack . BL.fromStrict . TE.encodeUtf8 +instance ConvertString [Word8] (Lenient String) where {-# INLINE convertString #-}; convertString = Lenient . TL.unpack . TLE.decodeUtf8With lenientDecode . BL.pack +instance ConvertString [Word8] (Lenient TL.Text) where {-# INLINE convertString #-}; convertString = Lenient . TLE.decodeUtf8With lenientDecode . BL.pack +instance ConvertString [Word8] (Lenient Text) where {-# INLINE convertString #-}; convertString = Lenient . TE.decodeUtf8With lenientDecode . B.pack +instance ConvertString [Word8] (Maybe String) where {-# INLINE convertString #-}; convertString = fmap TL.unpack . eitherToMaybe . TLE.decodeUtf8' . BL.pack +instance ConvertString [Word8] (Maybe TL.Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TLE.decodeUtf8' . BL.pack +instance ConvertString [Word8] (Maybe Text) where {-# INLINE convertString #-}; convertString = eitherToMaybe . TE.decodeUtf8' . B.pack +instance ConvertString [Word8] BL.ByteString where {-# INLINE convertString #-}; convertString = BL.pack +instance ConvertString [Word8] ByteString where {-# INLINE convertString #-}; convertString = B.pack +instance ConvertString [Word8] ShortByteString where {-# INLINE convertString #-}; convertString = S.pack +instance ConvertString [Word8] [Word8] where {-# INLINE convertString #-}; convertString = id + +instance EncodeString String BL.ByteString +instance EncodeString String ByteString +instance EncodeString String ShortByteString +instance EncodeString String [Word8] +instance EncodeString TL.Text BL.ByteString +instance EncodeString TL.Text ByteString +instance EncodeString TL.Text ShortByteString +instance EncodeString TL.Text [Word8] +instance EncodeString Text BL.ByteString +instance EncodeString Text ByteString +instance EncodeString Text ShortByteString +instance EncodeString Text [Word8] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/src/Intro/Trustworthy.hs new/intro-0.3.0.1/src/Intro/Trustworthy.hs --- old/intro-0.1.0.10/src/Intro/Trustworthy.hs 2017-03-03 05:57:48.000000000 +0100 +++ new/intro-0.3.0.1/src/Intro/Trustworthy.hs 2017-03-29 01:18:47.000000000 +0200 @@ -7,7 +7,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Intro.Trustworthy --- Copyright : (c) Daniel Mendler 2016 +-- Copyright : (c) Daniel Mendler 2016-2017 -- License : MIT -- -- Maintainer : [email protected] @@ -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" #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/src/Intro.hs new/intro-0.3.0.1/src/Intro.hs --- old/intro-0.1.0.10/src/Intro.hs 2017-03-03 06:13:47.000000000 +0100 +++ new/intro-0.3.0.1/src/Intro.hs 2017-04-05 10:45:06.000000000 +0200 @@ -9,7 +9,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Intro --- Copyright : (c) Daniel Mendler 2016 +-- Copyright : (c) Daniel Mendler 2016-2017 -- License : MIT -- -- Maintainer : [email protected] @@ -28,19 +28,19 @@ -- -- List of design decisions: -- --- * Keep everything at one place (There are one two modules and Intro.Trustworthy is only there for Safe Haskell) +-- * Keep everything at one place (There are only three modules and Intro.Trustworthy is only there for Safe Haskell) -- * Conservative extension over the base Prelude -- * Rely only on very common external libraries -- * Avoid writing custom functions -- * 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 +-- * Prefer Text over String, provide 'ConvertString' and 'EncodeString' -- * Provide Monad transformers -- * Provide container types -- * Prefer generic functions --- * Debugging functions, like 'Intro.Trustworthy.trace' and 'undefined' are available but produce compile time warnings +-- * Debugging functions, like 'trace' and 'undefined' are available but produce compile time warnings -- * Don't provide error, only panic instead --- * Compatibility with Control.Lens +-- * Compatibility with unqualified import of Control.Lens -- -- Some 'Prelude' functions are missing from 'Intro'. More general variants are available for the following functions: -- @@ -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 'Read' and 'Show' class functions are not provided. Don't write these instances yourself. +-- * Some 'Text.Read.Read' and 'Show' class functions are not provided. Don't write these instances yourself. -- -- Additional types and functions: -- @@ -187,7 +187,6 @@ , Data.List.zip3 , Data.List.zipWith , Data.List.zipWith3 - -- , Data.List.cycle -- partial , Safe.headDef , Safe.headMay -- prefer pattern match , Safe.initDef @@ -242,10 +241,13 @@ -- ** ByteString , Data.ByteString.ByteString , LByteString + , Data.ByteString.Short.ShortByteString - -- ** Conversion + -- ** String conversion , Data.String.IsString(fromString) - , Data.String.Conversions.ConvertibleStrings(convertString) + , Intro.ConvertString.ConvertString(convertString) + , Intro.ConvertString.EncodeString(encodeString, decodeString, decodeStringLenient) + , Lenient(..) -- * Container types @@ -262,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 @@ -363,7 +363,7 @@ #endif , readMaybe - -- * Equality and Ordering + -- * Equality and ordering -- ** Eq , Data.Eq.Eq((==), (/=)) @@ -493,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(mzero, mplus) , Control.Monad.join , Control.Monad.guard , Control.Monad.when @@ -538,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 @@ -624,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 @@ -650,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 @@ -668,11 +670,10 @@ import Data.Maybe (Maybe, fromMaybe) 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 Intro.ConvertString +import Intro.Trustworthy import System.IO (FilePath) -import Text.Read (Read) import Text.Show (Show) import qualified Control.Applicative import qualified Control.Category @@ -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 @@ -729,7 +730,6 @@ import qualified Data.Void import qualified Data.Word import qualified GHC.Generics -import qualified Intro.Trustworthy import qualified Numeric.Natural import qualified Prelude import qualified Safe @@ -769,9 +769,9 @@ map = fmap {-# INLINE map #-} --- | Convert a value to a readable string type supported by 'ConvertibleStrings' using the 'Show' instance. -show :: (Show a, IsString s) => a -> s -show = fromString . showS +-- | Convert a value to a readable string type supported by 'ConvertString' using the 'Show' instance. +show :: (Show a, ConvertString String s) => a -> s +show = convertString . showS {-# INLINE show #-} -- | Convert a value to a readable 'Text' using the 'Show' instance. @@ -786,7 +786,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 -> Maybe b +readMaybe :: (Text.Read.Read b, ConvertString a String) => a -> Maybe b readMaybe = Text.Read.readMaybe . convertString {-# INLINE readMaybe #-} @@ -870,10 +870,12 @@ {-# INLINE appendFile #-} -- | Read an entire file strictly into a 'Text' using UTF-8 encoding. +-- The decoding is done using 'decodeStringLenient'. Invalid characters are replaced +-- by the Unicode replacement character '\FFFD'. -- -- __Note__: This function is lifted to the 'MonadIO' class. readFileUtf8 :: MonadIO m => FilePath -> m Text -readFileUtf8 = map convertString . readFile +readFileUtf8 = map decodeStringLenient . readFile {-# INLINE readFileUtf8 #-} -- | Write a 'Text' to a file using UTF-8 encoding. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/test/compat.hs new/intro-0.3.0.1/test/compat.hs --- old/intro-0.1.0.10/test/compat.hs 2017-01-09 20:20:17.000000000 +0100 +++ new/intro-0.3.0.1/test/compat.hs 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -{-# LANGUAGE NoImplicitPrelude #-} -{-# LANGUAGE OverloadedStrings #-} -module Main where - -import BaseCompat -import LensCompat - -main :: IO () -main = pure () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/intro-0.1.0.10/test/test.hs new/intro-0.3.0.1/test/test.hs --- old/intro-0.1.0.10/test/test.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/intro-0.3.0.1/test/test.hs 2017-04-05 10:34:40.000000000 +0200 @@ -0,0 +1,73 @@ +{-# LANGUAGE ExplicitForAll #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE ScopedTypeVariables #-} +module Main where + +import BaseCompat () +import Data.ByteString.Short (ShortByteString) +import Intro +import LensCompat () +import Test.QuickCheck +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 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, 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 + quickCheck $ \(a :: a) -> decodeString (encodeString a :: b) == Just a + quickCheck $ \(a :: a) -> decodeStringLenient (encodeString a :: b) == a
