packages feed

incipit-base 0.5.1.0 → 0.7.0.2

raw patch · 8 files changed

Files

changelog.md view
@@ -1,4 +1,10 @@-# Unreleased+# 0.7.0.0++* Write trace messages to stderr.++# 0.6.0.0++* Add polymorphic type family `Undefined` that emits a `TypeError`.  # 0.5.0.0 
incipit-base.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.35.0.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack  name:           incipit-base-version:        0.5.1.0+version:        0.7.0.2 synopsis:       A Prelude for Polysemy – Base Reexports description:    See https://hackage.haskell.org/package/incipit-base/docs/IncipitBase.html category:       Prelude@@ -13,7 +13,7 @@ bug-reports:    https://github.com/tek/incipit-core/issues author:         Torsten Schmits maintainer:     hackage@tryp.io-copyright:      2023 Torsten Schmits+copyright:      2025 Torsten Schmits license:        BSD-2-Clause-Patent license-file:   LICENSE build-type:     Simple@@ -75,6 +75,7 @@   hs-source-dirs:       lib   default-extensions:+      NoImplicitPrelude       AllowAmbiguousTypes       ApplicativeDo       BlockArguments@@ -89,9 +90,12 @@       GADTs       LambdaCase       LiberalTypeSynonyms+      MonadComprehensions       MultiWayIf+      NoFieldSelectors       OverloadedLabels       OverloadedLists+      OverloadedRecordDot       OverloadedStrings       PackageImports       PartialTypeSignatures@@ -107,42 +111,12 @@       UndecidableInstances       UnicodeSyntax       ViewPatterns-      BangPatterns-      BinaryLiterals-      ConstraintKinds-      DeriveDataTypeable-      DeriveFoldable-      DeriveFunctor-      DeriveGeneric-      DeriveLift-      DeriveTraversable-      DoAndIfThenElse-      EmptyCase-      EmptyDataDecls-      ExistentialQuantification-      FlexibleContexts-      FlexibleInstances-      GeneralizedNewtypeDeriving-      InstanceSigs-      KindSignatures-      MultiParamTypeClasses-      NamedFieldPuns-      PatternGuards-      PolyKinds-      RankNTypes-      ScopedTypeVariables-      StandaloneDeriving-      TupleSections-      TypeApplications-      TypeOperators-      TypeSynonymInstances-      NoImplicitPrelude   ghc-options: -Wall -Widentities -Wincomplete-uni-patterns -Wmissing-deriving-strategies -Wredundant-constraints -Wunused-type-patterns -Wunused-packages   build-depends:-      base >=4.13 && <4.19-    , bytestring-    , containers-    , data-default ==0.7.*-    , stm-    , text-  default-language: Haskell2010+      base >=4.17.2.1 && <4.23+    , bytestring >=0.11.1.0 && <0.13+    , containers >=0.6.3.1 && <0.9+    , data-default >=0.2 && <0.9+    , stm >=2.5.1.0 && <2.6+    , text >=2.0.2 && <2.2+  default-language: GHC2021
lib/Incipit/Base.hs view
@@ -1,3 +1,5 @@+{-# language CPP #-}+ -- |Reexports from @base@. module Incipit.Base (   module Control.Applicative,@@ -32,6 +34,9 @@   module Data.Traversable,   module Data.Tuple,   module Data.Typeable,+#if __GLASGOW_HASKELL__ >= 904+  module Data.Type.Equality,+#endif   module Data.Void,   module Data.Word,   module GHC.Base,@@ -156,6 +161,9 @@ import Data.Semigroup (Semigroup (..)) import Data.Traversable (Traversable (..), for, forM, mapAccumL, mapAccumR) import Data.Tuple (curry, fst, snd, swap, uncurry)+#if __GLASGOW_HASKELL__ >= 904+import Data.Type.Equality (type (~))+#endif import Data.Typeable (Typeable) import Data.Void (Void) import Data.Word (Word, Word16, Word32, Word64, Word8)
lib/Incipit/Debug.hs view
@@ -6,19 +6,18 @@ import qualified Data.Text as Text import Data.Text (Text) import GHC.Stack (CallStack, SrcLoc (..), callStack, getCallStack)+import System.IO (IO, hPutStrLn, stderr) import System.IO.Unsafe (unsafePerformIO)  import Incipit.Base (   Applicative (pure),   Functor ((<$)),   HasCallStack,-  IO,   Monad,   Semigroup ((<>)),   Show,   error,   fromMaybe,-  putStrLn,   ) import Incipit.List (last) import Incipit.String.Conversion (ToString (toString), ToText (toText), show)@@ -33,7 +32,7 @@   Text ->   IO () debugPrint SrcLoc {srcLocModule = (toText -> slm), srcLocStartLine} !msg =-  putStrLn (toString moduleName <> ":" <> show srcLocStartLine <> " " <> toString msg)+  hPutStrLn stderr (toString moduleName <> ":" <> show srcLocStartLine <> " " <> toString msg)   where     moduleName =       fromMaybe slm (last (Text.splitOn "." slm))@@ -68,7 +67,7 @@   m () dbgs a =   debugPrintWithLoc (srcLoc callStack) (show a)-{-# noinline dbgs_ #-}+{-# noinline dbgs #-}  -- |Print a value with a 'Show' instance in an arbitrary 'Monad', returning the value. dbgs_ ::@@ -80,7 +79,7 @@   m a dbgs_ a =   a <$ debugPrintWithLoc (srcLoc callStack) (show a)-{-# noinline dbgs #-}+{-# noinline dbgs_ #-}  -- |Like 'Debug.Trace.trace', but with 'Text' and with source location prefix. tr ::
lib/Incipit/Foldable.hs view
@@ -6,7 +6,7 @@  import qualified Data.Foldable as Foldable import Data.Foldable (-  Foldable (elem, fold, foldMap, foldMap', foldl', foldl1, foldr, foldr', foldr1, length, null, product, sum, toList),+  Foldable (elem, fold, foldMap, foldMap', foldl, foldl', foldl1, foldr, foldr', foldr1, length, null, product, sum, toList),   all,   and,   any,@@ -25,18 +25,6 @@   ) 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 ::
lib/Incipit/List.hs view
@@ -29,5 +29,5 @@ tail :: [a] -> Maybe [a] tail = \case   [] -> Nothing-  as -> Just (List.tail as)+  _ : as -> Just as {-# inline tail #-}
lib/Incipit/String/Reexport.hs view
@@ -1,4 +1,5 @@ {-# options_haddock prune #-}+{-# language CPP #-}  {- | Copyright:  (c) 2016 Stephen Diehl@@ -47,6 +48,9 @@ import Text.Read (Read, readMaybe, reads)  import Incipit.Base (Constraint, Type)+#if __GLASGOW_HASKELL__ >= 904+import Incipit.Base (type (~))+#endif   -- $setup
lib/Incipit/TypeError.hs view
@@ -1,24 +1,39 @@-{-# language StandaloneKindSignatures #-}+{-# language StandaloneKindSignatures, CPP #-}+#if __GLASGOW_HASKELL__ >= 910+{-# language TypeAbstractions #-}+#endif  -- | Description: 'ErrorMessage' concatenation operators, stolen from type-errors-pretty. module Incipit.TypeError where -import GHC.TypeLits (ErrorMessage (..), Symbol)+import GHC.TypeLits (ErrorMessage (..), Symbol, TypeError) +-- | Concat two error message strings. type (<>) :: k1 -> k2 -> ErrorMessage type family (<>) l r :: ErrorMessage where   l <> r = ToErrorMessage l ':<>: ToErrorMessage r  infixl 5 <> +-- | Concat two error message strings with a newline. type (%) :: k1 -> k2 -> ErrorMessage type family (%) t b :: ErrorMessage where   t % b = ToErrorMessage t ':$$: ToErrorMessage b  infixr 4 % +-- | Convert a 'Symbol', 'ErrorMessage' or type to an 'ErrorMessage'. type ToErrorMessage :: k -> ErrorMessage type family ToErrorMessage t where   ToErrorMessage (t :: Symbol) = 'Text t   ToErrorMessage (t :: ErrorMessage) = t   ToErrorMessage t = 'ShowType t++-- | Placeholder similar to 'IncipitBase.undefined'.+type Undefined :: k+#if __GLASGOW_HASKELL__ >= 910+type family Undefined @k where+#else+type family Undefined where+#endif+  Undefined = TypeError ('Text "undefined")