incipit-base 0.3.0.0 → 0.4.0.0
raw patch · 8 files changed
+170/−41 lines, 8 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
- Incipit.Base: all :: Foldable t => (a -> Bool) -> t a -> Bool
- Incipit.Base: and :: Foldable t => t Bool -> Bool
- Incipit.Base: any :: Foldable t => (a -> Bool) -> t a -> Bool
- Incipit.Base: asum :: (Foldable t, Alternative f) => t (f a) -> f a
- Incipit.Base: class Foldable (t :: Type -> Type)
- Incipit.Base: concat :: Foldable t => t [a] -> [a]
- Incipit.Base: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- Incipit.Base: data Nat
- Incipit.Base: elem :: (Foldable t, Eq a) => a -> t a -> Bool
- Incipit.Base: find :: Foldable t => (a -> Bool) -> t a -> Maybe a
- Incipit.Base: fold :: (Foldable t, Monoid m) => t m -> m
- Incipit.Base: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- Incipit.Base: foldMap' :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- Incipit.Base: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
- Incipit.Base: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- Incipit.Base: foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
- Incipit.Base: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Incipit.Base: foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Incipit.Base: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- Incipit.Base: forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
- Incipit.Base: for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
- Incipit.Base: length :: Foldable t => t a -> Int
- Incipit.Base: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- Incipit.Base: maximum :: (Foldable t, Ord a) => t a -> a
- Incipit.Base: minimum :: (Foldable t, Ord a) => t a -> a
- Incipit.Base: null :: Foldable t => t a -> Bool
- Incipit.Base: or :: Foldable t => t Bool -> Bool
- Incipit.Base: product :: (Foldable t, Num a) => t a -> a
- Incipit.Base: sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
- Incipit.Base: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- Incipit.Base: sum :: (Foldable t, Num a) => t a -> a
- Incipit.Base: toList :: Foldable t => t a -> [a]
- Incipit.Base: traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- Incipit.Misc: foldl :: forall t b a. Foldable t => (b -> a -> b) -> b -> t a -> b
+ Incipit.Base: SomeChar :: Proxy n -> SomeChar
+ Incipit.Base: [EQI] :: forall {k} (a :: k). Compare a a ~ 'EQ => OrderingI a a
+ Incipit.Base: [GTI] :: forall {k} (a :: k) (b :: k). Compare a b ~ 'GT => OrderingI a b
+ Incipit.Base: [LTI] :: forall {k} (a :: k) (b :: k). Compare a b ~ 'LT => OrderingI a b
+ Incipit.Base: charVal :: forall (n :: Char) proxy. KnownChar n => proxy n -> Char
+ Incipit.Base: charVal' :: forall (n :: Char). KnownChar n => Proxy# n -> Char
+ Incipit.Base: class KnownChar (n :: Char)
+ Incipit.Base: cmpChar :: forall (a :: Char) (b :: Char) proxy1 proxy2. (KnownChar a, KnownChar b) => proxy1 a -> proxy2 b -> OrderingI a b
+ Incipit.Base: cmpNat :: forall (a :: Nat) (b :: Nat) proxy1 proxy2. (KnownNat a, KnownNat b) => proxy1 a -> proxy2 b -> OrderingI a b
+ Incipit.Base: cmpSymbol :: forall (a :: Symbol) (b :: Symbol) proxy1 proxy2. (KnownSymbol a, KnownSymbol b) => proxy1 a -> proxy2 b -> OrderingI a b
+ Incipit.Base: data OrderingI (a :: k) (b :: k)
+ Incipit.Base: data SomeChar
+ Incipit.Base: sameChar :: forall (a :: Char) (b :: Char) proxy1 proxy2. (KnownChar a, KnownChar b) => proxy1 a -> proxy2 b -> Maybe (a :~: b)
+ Incipit.Base: showParen :: Bool -> ShowS -> ShowS
+ Incipit.Base: showString :: String -> ShowS
+ Incipit.Base: showsPrec :: Show a => Int -> a -> ShowS
+ Incipit.Base: someCharVal :: Char -> SomeChar
+ Incipit.Base: type Nat = Natural
+ Incipit.Foldable: all :: Foldable t => (a -> Bool) -> t a -> Bool
+ Incipit.Foldable: and :: Foldable t => t Bool -> Bool
+ Incipit.Foldable: any :: Foldable t => (a -> Bool) -> t a -> Bool
+ Incipit.Foldable: asum :: (Foldable t, Alternative f) => t (f a) -> f a
+ Incipit.Foldable: class Foldable (t :: TYPE LiftedRep -> Type)
+ Incipit.Foldable: concat :: Foldable t => t [a] -> [a]
+ Incipit.Foldable: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
+ Incipit.Foldable: elem :: (Foldable t, Eq a) => a -> t a -> Bool
+ Incipit.Foldable: find :: Foldable t => (a -> Bool) -> t a -> Maybe a
+ Incipit.Foldable: fold :: (Foldable t, Monoid m) => t m -> m
+ Incipit.Foldable: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
+ Incipit.Foldable: foldMap' :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
+ Incipit.Foldable: foldl :: forall t b a. Foldable t => (b -> a -> b) -> b -> t a -> b
+ Incipit.Foldable: foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
+ Incipit.Foldable: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
+ Incipit.Foldable: foldlM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
+ Incipit.Foldable: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ Incipit.Foldable: foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b
+ Incipit.Foldable: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
+ Incipit.Foldable: forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
+ Incipit.Foldable: for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
+ Incipit.Foldable: infix 4 `elem`
+ Incipit.Foldable: length :: Foldable t => t a -> Int
+ Incipit.Foldable: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
+ Incipit.Foldable: maximum :: forall t a. Ord a => Foldable t => t a -> Maybe a
+ Incipit.Foldable: maximumBy :: forall t a. Foldable t => (a -> a -> Ordering) -> t a -> Maybe a
+ Incipit.Foldable: minimum :: forall t a. Ord a => Foldable t => t a -> Maybe a
+ Incipit.Foldable: minimumBy :: forall t a. Foldable t => (a -> a -> Ordering) -> t a -> Maybe a
+ Incipit.Foldable: null :: Foldable t => t a -> Bool
+ Incipit.Foldable: or :: Foldable t => t Bool -> Bool
+ Incipit.Foldable: product :: (Foldable t, Num a) => t a -> a
+ Incipit.Foldable: sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
+ Incipit.Foldable: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
+ Incipit.Foldable: sum :: (Foldable t, Num a) => t a -> a
+ Incipit.Foldable: toList :: Foldable t => t a -> [a]
+ Incipit.Foldable: traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
- Incipit.Base: type (x :: Nat) <= (y :: Nat) = x <=? y ~ 'True
+ Incipit.Base: type (x :: k) <= (y :: k) = x <=? y ~ 'True
- Incipit.Base: type Type = Type
+ Incipit.Base: type Type = TYPE LiftedRep
- Incipit.Base: type family AppendSymbol (a :: Symbol) (b :: Symbol) :: Symbol
+ Incipit.Base: type family NatToChar (a :: Natural) :: Char
Files
- changelog.md +21/−0
- incipit-base.cabal +13/−5
- lib/Incipit/Base.hs +4/−19
- lib/Incipit/Debug.hs +2/−1
- lib/Incipit/Foldable.hs +91/−0
- lib/Incipit/Misc.hs +0/−14
- lib/Incipit/String/Conversion.hs +2/−2
- readme.md +37/−0
+ changelog.md view
@@ -0,0 +1,21 @@+# Unreleased++# 0.4.0.0++* Add safe versions of `Foldable.minimum` et al.+* Export `showsPrec`, `showParen`, `showString`.++# 0.3.0.0++* Add safe versions of `Fractional` division methods.+* Add `fromText`.+* Remove module exports for `Prelude` to avoid a Stack bug.+* Rename `Incipit` modules to `IncipitBase` and `IncipitCore`.+* Export `withFrozenCallStack`.+* Add `leftA`, an `Either` combinator that runs an applicative action on a `Left`.++# 0.2.0.0++* Add safe, `Maybe` returning, versions of the methods of `Integral`.+* Hide constructors of effect GADTs.+* Reexport `Data.Text.Lazy.Builder`.
incipit-base.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.34.6.+-- This file has been generated from package.yaml by hpack version 0.35.0. -- -- see: https://github.com/sol/hpack name: incipit-base-version: 0.3.0.0+version: 0.4.0.0 synopsis: A Prelude for Polysemy – Base Reexports description: See https://hackage.haskell.org/package/incipit-base/docs/IncipitBase.html category: Prelude@@ -17,6 +17,9 @@ license: BSD-2-Clause-Patent license-file: LICENSE build-type: Simple+extra-source-files:+ changelog.md+ readme.md source-repository head type: git@@ -28,6 +31,7 @@ Incipit.Debug Incipit.Either Incipit.Fixed+ Incipit.Foldable Incipit.Fractional Incipit.Integral Incipit.Libraries@@ -56,6 +60,8 @@ , Data.IntSet , Data.Map.Lazy , Data.Map.Strict+ , Data.Map.Merge.Lazy+ , Data.Map.Merge.Strict , Data.Sequence , Data.Set , Data.Text@@ -68,6 +74,7 @@ hs-source-dirs: lib default-extensions:+ NoImplicitPrelude AllowAmbiguousTypes ApplicativeDo BangPatterns@@ -88,6 +95,7 @@ DisambiguateRecordFields DoAndIfThenElse DuplicateRecordFields+ EmptyCase EmptyDataDecls ExistentialQuantification FlexibleContexts@@ -102,8 +110,9 @@ MultiParamTypeClasses MultiWayIf NamedFieldPuns- OverloadedStrings+ OverloadedLabels OverloadedLists+ OverloadedStrings PackageImports PartialTypeSignatures PatternGuards@@ -127,10 +136,9 @@ UndecidableInstances UnicodeSyntax ViewPatterns- NoImplicitPrelude ghc-options: -Wall -Wredundant-constraints -Wincomplete-uni-patterns -Wmissing-deriving-strategies -Widentities -Wunused-packages build-depends:- base >=4.13 && <4.17+ base >=4.13 && <4.18 , bytestring , containers , data-default >=0.2
lib/Incipit/Base.hs view
@@ -15,7 +15,6 @@ module Data.Coerce, module Data.Either, module Data.Eq,- module Data.Foldable, module Data.Function, module Data.Functor, module Data.Functor.Compose,@@ -47,10 +46,12 @@ module GHC.Stack, module GHC.TypeLits, module Incipit.Fixed,+ module Incipit.Foldable, module Incipit.Fractional, module Incipit.Integral, module Numeric.Natural, module System.IO,+ module Text.Show, ) where import Control.Applicative (@@ -95,24 +96,6 @@ import Data.Coerce (Coercible, coerce) import Data.Either import Data.Eq (Eq (..))-import Data.Foldable (- Foldable (elem, fold, foldMap, foldMap', foldl', foldl1, foldr, foldr', foldr1, length, maximum, minimum, null, product, sum, toList),- all,- and,- any,- asum,- concat,- concatMap,- find,- foldlM,- forM_,- for_,- mapM_,- or,- sequenceA_,- sequence_,- traverse_,- ) import Data.Function (const, fix, flip, id, on, ($), (&), (.)) import Data.Functor (Functor (..), void, ($>), (<$>), (<&>)) import Data.Functor.Compose (Compose (..))@@ -206,7 +189,9 @@ import GHC.TypeLits hiding (ErrorMessage (Text)) import Numeric.Natural (Natural) import System.IO (FilePath, IO, print, putStr, putStrLn)+import Text.Show (showParen, showString, showsPrec) import Incipit.Fixed+import Incipit.Foldable import Incipit.Fractional import Incipit.Integral hiding (safeOp)
lib/Incipit/Debug.hs view
@@ -32,7 +32,7 @@ SrcLoc -> Text -> IO ()-debugPrint SrcLoc {srcLocModule = (toText -> slm), srcLocStartLine} msg =+debugPrint SrcLoc {srcLocModule = (toText -> slm), srcLocStartLine} !msg = putStrLn (toString moduleName <> ":" <> show srcLocStartLine <> " " <> toString msg) where moduleName =@@ -44,6 +44,7 @@ Text -> m () debugPrintWithLoc loc msg = do+ () <- pure () () <- pure (unsafePerformIO (debugPrint loc msg)) pure ()
+ lib/Incipit/Foldable.hs view
@@ -0,0 +1,91 @@+-- |Overrides for problematic 'Foldable' functions.+module Incipit.Foldable (+ module Incipit.Foldable,+ module Data.Foldable,+) where++import qualified Data.Foldable as Foldable+import Data.Foldable (+ Foldable (elem, fold, foldMap, foldMap', foldl', foldl1, foldr, foldr', foldr1, length, null, product, sum, toList),+ all,+ and,+ any,+ asum,+ concat,+ concatMap,+ find,+ foldlM,+ forM_,+ for_,+ mapM_,+ or,+ sequenceA_,+ sequence_,+ traverse_,+ )+import Data.Maybe (Maybe (Just, Nothing))+import Data.Ord (Ord, Ordering)++-- |Default to using the strict version since the lazy one is so controversial.+foldl ::+ ∀ t b a .+ Foldable t =>+ (b -> a -> b) ->+ b ->+ t a ->+ b+foldl =+ Foldable.foldl'+{-# inlineable foldl #-}++-- |Safe version of 'Foldable.minimum'.+minimum ::+ ∀ t a .+ Ord a =>+ Foldable t =>+ t a ->+ Maybe a+minimum ta =+ if null ta+ then Nothing+ else Just (Foldable.minimum ta)+{-# inlineable minimum #-}++-- |Safe version of 'Foldable.minimumBy'.+minimumBy ::+ ∀ t a .+ Foldable t =>+ (a -> a -> Ordering) ->+ t a ->+ Maybe a+minimumBy cmp ta =+ if null ta+ then Nothing+ else Just (Foldable.minimumBy cmp ta)+{-# inlineable minimumBy #-}++-- |Safe version of 'Foldable.maximum'.+maximum ::+ ∀ t a .+ Ord a =>+ Foldable t =>+ t a ->+ Maybe a+maximum ta =+ if null ta+ then Nothing+ else Just (Foldable.maximum ta)+{-# inlineable maximum #-}++-- |Safe version of 'Foldable.maximumBy'.+maximumBy ::+ ∀ t a .+ Foldable t =>+ (a -> a -> Ordering) ->+ t a ->+ Maybe a+maximumBy cmp ta =+ if null ta+ then Nothing+ else Just (Foldable.maximumBy cmp ta)+{-# inlineable maximumBy #-}
lib/Incipit/Misc.hs view
@@ -1,8 +1,6 @@ -- |Misc combinators. module Incipit.Misc where -import qualified Data.Foldable as Foldable- import Incipit.Base -- |Convenience alias for @pure ()@.@@ -43,15 +41,3 @@ ifM condM onTrue onFalse = condM >>= \ cond -> if cond then onTrue else onFalse {-# inline ifM #-}---- |Default to using the strict version since the lazy one is so controversial.-foldl ::- ∀ t b a .- Foldable t =>- (b -> a -> b) ->- b ->- t a ->- b-foldl =- Foldable.foldl'-{-# inline foldl #-}
lib/Incipit/String/Conversion.hs view
@@ -106,7 +106,7 @@ {-# INLINE encodeUtf8 #-} decodeUtf8 :: ByteString -> String- decodeUtf8 = T.unpack . T.decodeUtf8+ decodeUtf8 = T.unpack . decodeUtf8 {-# INLINE decodeUtf8 #-} decodeUtf8Strict :: ByteString -> Either T.UnicodeException String@@ -148,7 +148,7 @@ {-# INLINE encodeUtf8 #-} decodeUtf8 :: LByteString -> String- decodeUtf8 = LT.unpack . LT.decodeUtf8+ decodeUtf8 = LT.unpack . decodeUtf8 {-# INLINE decodeUtf8 #-} decodeUtf8Strict :: LByteString -> Either T.UnicodeException String
+ readme.md view
@@ -0,0 +1,37 @@+# About++This library is part of [incipit], a set of `Prelude` modules for the [Polysemy] ecosystem.+It contains the reexports from `base` that are inherited by the other two packages.++# Usage++Using a custom `Prelude` requires the use of Cabal mixins to hide the module from `base` and replace it with+`IncipitBase`:++For `hpack`:+```yaml+dependencies:+ - name: base+ version: '>= 4 && < 5'+ mixin:+ - hiding (Prelude)+ - name: incipit-base+ version: '>= 0.3'+ mixin:+ - (IncipitBase as Prelude)+ - hiding (IncipitBase)+```++For `cabal`:+```cabal+build-depends:+ base >=4 && <5, incipit-base >= 0.3+mixins:+ base hiding (Prelude), incipit-base (IncipitBase as Prelude), incipit-base hiding (IncipitBase)+```++`incipit-base` used to export `Prelude`, but+[stack can't deal with that](https://github.com/commercialhaskell/stack/issues/5414).++[incipit]: https://hackage.haskell.org/package/incipit+[Polysemy]: https://hackage.haskell.org/package/polysemy