base 4.20.2.0 → 4.21.0.0
raw patch · 39 files changed
+1170/−396 lines, 39 filesdep ~ghc-internalPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc-internal
API changes (from Hackage documentation)
- Control.Exception: ErrorCallWithLocation :: String -> String -> ErrorCall
- Control.Exception: pattern ErrorCall :: String -> ErrorCall
- Control.Exception.Base: ErrorCallWithLocation :: String -> String -> ErrorCall
- Control.Exception.Base: pattern ErrorCall :: String -> ErrorCall
- Control.Monad.IO.Class: instance Control.Monad.IO.Class.MonadIO GHC.Types.IO
- Control.Monad.Zip: instance (Control.Monad.Zip.MonadZip f, Control.Monad.Zip.MonadZip g) => Control.Monad.Zip.MonadZip (f GHC.Internal.Generics.:*: g)
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Base.NonEmpty
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Functor.Identity.Identity
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Monoid.First
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Monoid.Last
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Ord.Down
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Proxy.Proxy
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Semigroup.Internal.Dual
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Semigroup.Internal.Product
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Data.Semigroup.Internal.Sum
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Generics.Par1
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Generics.U1
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Internal.Maybe.Maybe
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Tuple.Solo
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip []
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip f => Control.Monad.Zip.MonadZip (GHC.Internal.Data.Semigroup.Internal.Alt f)
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip f => Control.Monad.Zip.MonadZip (GHC.Internal.Generics.M1 i c f)
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip f => Control.Monad.Zip.MonadZip (GHC.Internal.Generics.Rec1 f)
- Data.Complex: instance Control.Monad.Zip.MonadZip Data.Complex.Complex
- Data.Functor.Product: instance (Control.Monad.Zip.MonadZip f, Control.Monad.Zip.MonadZip g) => Control.Monad.Zip.MonadZip (Data.Functor.Product.Product f g)
- GHC.Exception: ErrorCallWithLocation :: String -> String -> ErrorCall
- GHC.Exception: pattern ErrorCall :: String -> ErrorCall
- GHC.Exception: showCCSStack :: [String] -> [String]
- GHC.Pack: packCString# :: [Char] -> ByteArray#
- GHC.Pack: unpackAppendCString# :: Addr# -> [Char] -> [Char]
- GHC.Pack: unpackCString :: Ptr a -> [Char]
- GHC.Pack: unpackCString# :: Addr# -> [Char]
- GHC.Pack: unpackFoldrCString# :: Addr# -> (Char -> a -> a) -> a -> a
- GHC.Pack: unpackNBytes# :: Addr# -> Int# -> [Char]
- GHC.RTS.Flags: getIoManagerFlag :: IO IoSubSystem
+ Control.Exception: ErrorCall :: String -> ErrorCall
+ Control.Exception: NoBacktrace :: e -> NoBacktrace e
+ Control.Exception: WhileHandling :: SomeException -> WhileHandling
+ Control.Exception: catchNoPropagate :: Exception e => IO a -> (ExceptionWithContext e -> IO a) -> IO a
+ Control.Exception: data WhileHandling
+ Control.Exception: newtype NoBacktrace e
+ Control.Exception: pattern ErrorCallWithLocation :: String -> String -> ErrorCall
+ Control.Exception: rethrowIO :: Exception e => ExceptionWithContext e -> IO a
+ Control.Exception: tryWithContext :: Exception e => IO a -> IO (Either (ExceptionWithContext e) a)
+ Control.Exception.Base: ErrorCall :: String -> ErrorCall
+ Control.Exception.Base: pattern ErrorCallWithLocation :: String -> String -> ErrorCall
+ Data.Array.Byte: instance GHC.Internal.TH.Lift.Lift Data.Array.Byte.ByteArray
+ Data.Bitraversable: firstA :: (Bitraversable t, Applicative f) => (a -> f c) -> t a b -> f (t c b)
+ Data.Bitraversable: secondA :: (Bitraversable t, Applicative f) => (b -> f c) -> t a b -> f (t a c)
+ Data.Bounded: class Bounded a
+ Data.Bounded: maxBound :: Bounded a => a
+ Data.Bounded: minBound :: Bounded a => a
+ Data.Complex: instance GHC.Internal.Control.Monad.Zip.MonadZip Data.Complex.Complex
+ Data.Fixed: instance forall k (a :: k). GHC.Internal.TH.Lift.Lift (Data.Fixed.Fixed a)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Eq1 f, Data.Functor.Classes.Eq1 g) => Data.Functor.Classes.Eq1 (f GHC.Internal.Generics.:*: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Eq1 f, Data.Functor.Classes.Eq1 g) => Data.Functor.Classes.Eq1 (f GHC.Internal.Generics.:+: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Eq1 f, Data.Functor.Classes.Eq1 g) => Data.Functor.Classes.Eq1 (f GHC.Internal.Generics.:.: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Ord1 f, Data.Functor.Classes.Ord1 g) => Data.Functor.Classes.Ord1 (f GHC.Internal.Generics.:*: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Ord1 f, Data.Functor.Classes.Ord1 g) => Data.Functor.Classes.Ord1 (f GHC.Internal.Generics.:+: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Ord1 f, Data.Functor.Classes.Ord1 g) => Data.Functor.Classes.Ord1 (f GHC.Internal.Generics.:.: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Read1 f, Data.Functor.Classes.Read1 g) => Data.Functor.Classes.Read1 (f GHC.Internal.Generics.:*: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Read1 f, Data.Functor.Classes.Read1 g) => Data.Functor.Classes.Read1 (f GHC.Internal.Generics.:+: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Read1 f, Data.Functor.Classes.Read1 g) => Data.Functor.Classes.Read1 (f GHC.Internal.Generics.:.: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Show1 f, Data.Functor.Classes.Show1 g) => Data.Functor.Classes.Show1 (f GHC.Internal.Generics.:*: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Show1 f, Data.Functor.Classes.Show1 g) => Data.Functor.Classes.Show1 (f GHC.Internal.Generics.:+: g)
+ Data.Functor.Classes: instance (Data.Functor.Classes.Show1 f, Data.Functor.Classes.Show1 g) => Data.Functor.Classes.Show1 (f GHC.Internal.Generics.:.: g)
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.Par1
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.U1
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.UAddr
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.UChar
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.UDouble
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.UFloat
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.UInt
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.UWord
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Internal.Generics.V1
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 f => Data.Functor.Classes.Eq1 (GHC.Internal.Generics.M1 i c f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 f => Data.Functor.Classes.Eq1 (GHC.Internal.Generics.Rec1 f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.Par1
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.U1
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.UAddr
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.UChar
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.UDouble
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.UFloat
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.UInt
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.UWord
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Internal.Generics.V1
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 f => Data.Functor.Classes.Ord1 (GHC.Internal.Generics.M1 i c f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 f => Data.Functor.Classes.Ord1 (GHC.Internal.Generics.Rec1 f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Read1 GHC.Internal.Generics.Par1
+ Data.Functor.Classes: instance Data.Functor.Classes.Read1 GHC.Internal.Generics.U1
+ Data.Functor.Classes: instance Data.Functor.Classes.Read1 GHC.Internal.Generics.V1
+ Data.Functor.Classes: instance Data.Functor.Classes.Read1 f => Data.Functor.Classes.Read1 (GHC.Internal.Generics.M1 i c f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Read1 f => Data.Functor.Classes.Read1 (GHC.Internal.Generics.Rec1 f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.Par1
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.U1
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.UAddr
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.UChar
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.UDouble
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.UFloat
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.UInt
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.UWord
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Internal.Generics.V1
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 f => Data.Functor.Classes.Show1 (GHC.Internal.Generics.M1 i c f)
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 f => Data.Functor.Classes.Show1 (GHC.Internal.Generics.Rec1 f)
+ Data.Functor.Classes: instance GHC.Classes.Eq c => Data.Functor.Classes.Eq1 (GHC.Internal.Generics.K1 i c)
+ Data.Functor.Classes: instance GHC.Classes.Ord c => Data.Functor.Classes.Ord1 (GHC.Internal.Generics.K1 i c)
+ Data.Functor.Classes: instance GHC.Internal.Read.Read c => Data.Functor.Classes.Read1 (GHC.Internal.Generics.K1 i c)
+ Data.Functor.Classes: instance GHC.Internal.Show.Show c => Data.Functor.Classes.Show1 (GHC.Internal.Generics.K1 i c)
+ Data.Functor.Product: instance (GHC.Internal.Control.Monad.Zip.MonadZip f, GHC.Internal.Control.Monad.Zip.MonadZip g) => GHC.Internal.Control.Monad.Zip.MonadZip (Data.Functor.Product.Product f g)
+ Data.List: compareLength :: [a] -> Int -> Ordering
+ Data.List: inits1 :: [a] -> [NonEmpty a]
+ Data.List: tails1 :: [a] -> [NonEmpty a]
+ Data.List.NonEmpty: compareLength :: NonEmpty a -> Int -> Ordering
+ GHC.Exception: ErrorCall :: String -> ErrorCall
+ GHC.Exception: pattern ErrorCallWithLocation :: String -> String -> ErrorCall
+ GHC.RTS.Flags: IoManagerFlagAuto :: IoManagerFlag
+ GHC.RTS.Flags: IoManagerFlagMIO :: IoManagerFlag
+ GHC.RTS.Flags: IoManagerFlagSelect :: IoManagerFlag
+ GHC.RTS.Flags: IoManagerFlagWin32Legacy :: IoManagerFlag
+ GHC.RTS.Flags: IoManagerFlagWinIO :: IoManagerFlag
+ GHC.RTS.Flags: [readTixFile] :: HpcFlags -> Bool
+ GHC.RTS.Flags: data IoManagerFlag
- Control.Exception: ioError :: IOError -> IO a
+ Control.Exception: ioError :: HasCallStack => IOError -> IO a
- Control.Exception.Base: ioError :: IOError -> IO a
+ Control.Exception.Base: ioError :: HasCallStack => IOError -> IO a
- GHC.Base: seq# :: a -> State# d -> (# State# d, a #)
+ GHC.Base: seq# :: a -> State# s -> (# State# s, a #)
- GHC.Base: type family MultMul (a :: Multiplicity) (b :: Multiplicity) :: Multiplicity
+ GHC.Base: type family Any :: k
- GHC.Exts: infix 4 <=##
+ GHC.Exts: infix 4 >=##
- GHC.Exts: pattern TypeLitChar :: () => TypeLitSort
+ GHC.Exts: pattern TypeLitSymbol :: () => TypeLitSort
- GHC.Exts: seq# :: a -> State# d -> (# State# d, a #)
+ GHC.Exts: seq# :: a -> State# s -> (# State# s, a #)
- GHC.Exts: type family MultMul (a :: Multiplicity) (b :: Multiplicity) :: Multiplicity
+ GHC.Exts: type family Any :: k
- GHC.IO: catchAny :: IO a -> (forall e. Exception e => e -> IO a) -> IO a
+ GHC.IO: catchAny :: IO a -> (forall e. (HasExceptionContext, Exception e) => e -> IO a) -> IO a
- GHC.IO.Exception: ioError :: IOError -> IO a
+ GHC.IO.Exception: ioError :: HasCallStack => IOError -> IO a
- GHC.RTS.Flags: HpcFlags :: Bool -> HpcFlags
+ GHC.RTS.Flags: HpcFlags :: Bool -> Bool -> HpcFlags
- GHC.RTS.Flags: MiscFlags :: RtsTime -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Word -> IoSubSystem -> Word32 -> MiscFlags
+ GHC.RTS.Flags: MiscFlags :: RtsTime -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Word -> IoManagerFlag -> Word32 -> MiscFlags
- GHC.RTS.Flags: [ioManager] :: MiscFlags -> IoSubSystem
+ GHC.RTS.Flags: [ioManager] :: MiscFlags -> IoManagerFlag
- GHC.Records: class HasField (x :: k) r a | x r -> a
+ GHC.Records: class HasField (x :: k) (r :: TYPE r_rep) (a :: TYPE a_rep) | x r -> a
- Prelude: ioError :: IOError -> IO a
+ Prelude: ioError :: HasCallStack => IOError -> IO a
- System.IO.Error: ioError :: IOError -> IO a
+ System.IO.Error: ioError :: HasCallStack => IOError -> IO a
Files
- base.cabal +5/−9
- changelog.md +59/−26
- src/Control/Category.hs +18/−1
- src/Control/Exception.hs +7/−1
- src/Control/Monad/IO/Class.hs +4/−57
- src/Control/Monad/Zip.hs +2/−121
- src/Data/Array/Byte.hs +48/−0
- src/Data/Bifoldable.hs +20/−6
- src/Data/Bifunctor.hs +2/−2
- src/Data/Bitraversable.hs +58/−2
- src/Data/Bounded.hs +25/−0
- src/Data/Complex.hs +5/−1
- src/Data/Enum.hs +11/−6
- src/Data/Fixed.hs +13/−0
- src/Data/Foldable.hs +24/−18
- src/Data/Foldable1.hs +21/−4
- src/Data/Functor.hs +1/−24
- src/Data/Functor/Classes.hs +325/−4
- src/Data/Functor/Compose.hs +3/−0
- src/Data/Functor/Product.hs +3/−0
- src/Data/Functor/Sum.hs +3/−0
- src/Data/List.hs +105/−0
- src/Data/List/NonEmpty.hs +40/−33
- src/Data/Monoid.hs +2/−0
- src/Data/Semigroup.hs +38/−15
- src/Data/Traversable.hs +17/−8
- src/GHC/Base.hs +133/−6
- src/GHC/Desugar.hs +10/−5
- src/GHC/Exception.hs +1/−1
- src/GHC/ExecutionStack/Internal.hs +1/−1
- src/GHC/Exts.hs +141/−2
- src/GHC/IO/Encoding/Iconv.hs +0/−1
- src/GHC/IO/Handle.hs +0/−0
- src/GHC/IO/StdHandles.hs +0/−0
- src/GHC/Pack.hs +0/−37
- src/GHC/RTS/Flags.hs +4/−2
- src/GHC/TypeLits/Internal.hs +1/−1
- src/GHC/TypeNats/Internal.hs +1/−1
- src/System/IO.hs +19/−1
base.cabal view
@@ -4,7 +4,7 @@ -- Make sure you are editing ghc-experimental.cabal.in, not ghc-experimental.cabal name: base-version: 4.20.2.0+version: 4.21.0.0 -- NOTE: Don't forget to update ./changelog.md license: BSD-3-Clause@@ -23,14 +23,14 @@ [Set](https://hackage.haskell.org/package/containers/docs/Data-Set.html) are available in the [containers](https://hackage.haskell.org/package/containers) library. To work with textual data, use the [text](https://hackage.haskell.org/package/text/docs/Data-Text.html) library. -extra-source-files:+extra-doc-files: changelog.md Library default-language: Haskell2010 default-extensions: NoImplicitPrelude build-depends:- ghc-internal == 9.1003.*,+ ghc-internal == 9.1201.*, ghc-prim, exposed-modules:@@ -46,8 +46,10 @@ , Data.Bifoldable1 , Data.Bifunctor , Data.Bitraversable+ , Data.Bounded , Data.Char , Data.Complex+ , Data.Enum , Data.Fixed , Data.Foldable1 , Data.Functor.Classes@@ -95,7 +97,6 @@ , Data.Dynamic , Data.Either , Data.Eq- , Data.Enum , Data.Foldable , Data.Function , Data.Functor@@ -221,7 +222,6 @@ , GHC.Num , GHC.OldList , GHC.OverloadedLabels- , GHC.Pack , GHC.Profiling , GHC.Ptr , GHC.Read@@ -323,9 +323,5 @@ System.CPUTime.Posix.ClockGetTime System.CPUTime.Posix.Times System.CPUTime.Posix.RUsage-- -- We need to set the unit id to base (without a version number)- -- as it's magic.- ghc-options: -this-unit-id base hs-source-dirs: src
changelog.md view
@@ -1,22 +1,58 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) -## 4.20.2 *July 2025*- * Fix incorrect results of `integerPowMod` when the base is 0 and the exponent is negative, and `integerRecipMod` when the modulus is zero ([#26017](https://gitlab.haskell.org/ghc/ghc/-/issues/26017)).- * Fix bug where `naturalAndNot` was incorrectly truncating results ([CLC proposal #350](github.com/haskell/core-libraries-committee/issues/350))--## 4.20.1 *Jan 2025*- * Shipped with GHC 9.10.2+## 4.21.0.0 December 2024+ * Shipped with GHC 9.12.1+ * Introduce `Data.Bounded` module exporting the `Bounded` typeclass (finishing [CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))+ * Deprecate export of `Bounded` class from `Data.Enum` ([CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208))+ * `GHC.Desugar` has been deprecated and should be removed in GHC 9.14. ([CLC proposal #216](https://github.com/haskell/core-libraries-committee/issues/216))+ * Add a `readTixFile` field to the `HpcFlags` record in `GHC.RTS.Flags` ([CLC proposal #276](https://github.com/haskell/core-libraries-committee/issues/276))+ * Add `compareLength` to `Data.List` and `Data.List.NonEmpty` ([CLC proposal #257](https://github.com/haskell/core-libraries-committee/issues/257))+ * Add `INLINE[1]` to `compareInt` / `compareWord` ([CLC proposal #179](https://github.com/haskell/core-libraries-committee/issues/179))+ * Refactor `GHC.RTS.Flags` in preparation for new I/O managers: introduce `data IoManagerFlag` and use it in `MiscFlags`, remove `getIoManagerFlag`, deprecate re-export of `IoSubSystem` ([CLC proposal #263](https://github.com/haskell/core-libraries-committee/issues/263))+ * Add the `MonadFix` instance for `(,) a`, similar to the one for `Writer a` ([CLC proposal #238](https://github.com/haskell/core-libraries-committee/issues/238))+ * Improve `toInteger :: Word32 -> Integer` on 64-bit platforms ([CLC proposal #259](https://github.com/haskell/core-libraries-committee/issues/259))+ * Make `flip` representation polymorphic ([CLC proposal #245](https://github.com/haskell/core-libraries-committee/issues/245))+ * The `HasField` class now supports representation polymorphism ([CLC proposal #194](https://github.com/haskell/core-libraries-committee/issues/194))+ * Make `read` accept binary integer notation ([CLC proposal #177](https://github.com/haskell/core-libraries-committee/issues/177))+ * Improve the performance of `Data.List.sort` using an improved merging strategy. Instead of `compare`, `sort` now uses `(>)` which may break *malformed* `Ord` instances ([CLC proposal #236](https://github.com/haskell/core-libraries-committee/issues/236))+ * Add `inits1` and `tails1` to `Data.List`, factored from the corresponding functions in `Data.List.NonEmpty` ([CLC proposal #252](https://github.com/haskell/core-libraries-committee/issues/252))+ * Add `firstA` and `secondA` to `Data.Bitraversable`. ([CLC proposal #172](https://github.com/haskell/core-libraries-committee/issues/172))+ * Deprecate `GHC.TypeNats.Internal`, `GHC.TypeLits.Internal`, `GHC.ExecutionStack.Internal` ([CLC proposal #217](https://github.com/haskell/core-libraries-committee/issues/217))+ * `System.IO.Error.ioError` and `Control.Exception.ioError` now both carry `HasCallStack` constraints ([CLC proposal #275](https://github.com/haskell/core-libraries-committee/issues/275))+ * Define `Eq1`, `Ord1`, `Show1` and `Read1` instances for basic `Generic` representation types. ([CLC proposal #273](https://github.com/haskell/core-libraries-committee/issues/273)) * `setNonBlockingMode` will no longer throw an exception when called on a FD associated with a unknown device type. ([CLC proposal #282](https://github.com/haskell/core-libraries-committee/issues/282))+ * Add exception type metadata to default exception handler output.+ ([CLC proposal #231](https://github.com/haskell/core-libraries-committee/issues/231)+ and [CLC proposal #261](https://github.com/haskell/core-libraries-committee/issues/261))+ * The [deprecation process of GHC.Pack](https://gitlab.haskell.org/ghc/ghc/-/issues/21461) has come its term. The module has now been removed from `base`. * Propagate HasCallStack from `errorCallWithCallStackException` to exception backtraces, fixing a bug in the implementation of [CLC proposal #164](https://github.com/haskell/core-libraries-committee/issues/164).+ * Annotate re-thrown exceptions with the backtrace as per [CLC proposal #202](https://github.com/haskell/core-libraries-committee/issues/202) (introduces `WhileHandling` and modifies such as `catch` and `onException` accordingly to propagate or rethrow exceptions)+ * Introduced `catchNoPropagate`, `rethrowIO` and `tryWithContext` as part of+ [CLC proposal #202](https://github.com/haskell/core-libraries-committee/issues/202) to+ facilitate *re*throwing exceptions without adding a `WhileHandling`+ context -- if *re*throwing `e`, you don't want to add `WhileHandling e` to+ the context since it will be redundant. These functions are mostly useful+ for libraries that define exception-handling combinators like `catch` and+ `onException`, such as `base`, or the `exceptions` package.+ * Move `Lift ByteArray` and `Lift Fixed` instances into `base` from `template-haskell`. See [CLC proposal #287](https://github.com/haskell/core-libraries-committee/issues/287). * Modify the implementation of `Control.Exception.throw` to avoid call-sites being inferred as diverging via precise exception. ([GHC #25066](https://gitlab.haskell.org/ghc/ghc/-/issues/25066), [CLC proposal #290](https://github.com/haskell/core-libraries-committee/issues/290))--## 4.20.0.1 *May 2024*- * Not shipped with any GHC: This is a documentation only release to fix various issues with base-4.20.0.0 docs due to the GHC internal split- * For an accounting of the issues fixed, see [#24875](https://gitlab.haskell.org/ghc/ghc/-/issues/24875)+ * Make `Debug.Trace.{traceEventIO,traceMarkerIO}` faster when tracing is disabled. See [CLC proposal #291](https://github.com/haskell/core-libraries-committee/issues/291).+ * The exception messages were improved according to [CLC proposal #285](https://github.com/haskell/core-libraries-committee/issues/285). In particular:+ * Improve the message of the uncaught exception handler+ * Make `displayException (SomeException e) = displayException e`. The+ additional information that is printed when exceptions are surfaced to+ the top-level is added by `uncaughtExceptionHandler`.+ * Get rid of the HasCallStack mechanism manually propagated by `ErrorCall`+ in favour of the more general HasCallStack exception backtrace+ mechanism, to remove duplicate call stacks for uncaught exceptions.+ * Freeze the callstack of `error`, `undefined`, `throwIO`, `ioException`,+ `ioError` to prevent leaking the implementation of these error functions+ into the callstack. ## 4.20.0.0 *May 2024* * Shipped with GHC 9.10.1+ * Introduce `Data.Enum` module exporting both `Enum` and `Bounded`. Note that the export of `Bounded` will be deprecated in a future release ([CLC proposal #208](https://github.com/haskell/core-libraries-committee/issues/208)) * Deprecate `GHC.Pack` ([#21461](https://gitlab.haskell.org/ghc/ghc/-/issues/21461)) * Export `foldl'` from `Prelude` ([CLC proposal #167](https://github.com/haskell/core-libraries-committee/issues/167)) * The top-level handler for uncaught exceptions now displays the output of `displayException` rather than `show` ([CLC proposal #198](https://github.com/haskell/core-libraries-committee/issues/198))@@ -28,11 +64,12 @@ * Implement `sconcat` for `instance Semigroup Data.Semigroup.First` and `instance Semigroup Data.Monoid.First` explicitly, increasing laziness ([CLC proposal #246](https://github.com/haskell/core-libraries-committee/issues/246)) * Add laws relating between `Foldable` / `Traversable` with `Bifoldable` / `Bitraversable` ([CLC proposal #205](https://github.com/haskell/core-libraries-committee/issues/205)) * The `Enum Int64` and `Enum Word64` instances now use native operations on 32-bit platforms, increasing performance by up to 1.5x on i386 and up to 5.6x with the JavaScript backend. ([CLC proposal #187](https://github.com/haskell/core-libraries-committee/issues/187))- * Exceptions can now be decorated with user-defined annotations via `ExceptionContext`.+ * Exceptions can now be decorated with user-defined annotations via `ExceptionContext` ([CLC proposal #200](https://github.com/haskell/core-libraries-committee/issues/200)) * Exceptions now capture backtrace information via their `ExceptionContext`. GHC supports several mechanisms by which backtraces can be collected which can be individually enabled and disabled via- `GHC.Exception.Backtrace.setBacktraceMechanismState`.+ `GHC.Exception.Backtrace.setBacktraceMechanismState` ([CLC proposal #199](https://github.com/haskell/core-libraries-committee/issues/199))+ * Add `HasCallStack` constraint to `Control.Exception.throw{,IO}` ([CLC proposal #201](https://github.com/haskell/core-libraries-committee/issues/201)) * Update to [Unicode 15.1.0](https://www.unicode.org/versions/Unicode15.1.0/). * Fix `withFile`, `withFileBlocking`, and `withBinaryFile` to not incorrectly annotate exceptions raised in wrapped computation. ([CLC proposal #237](https://github.com/haskell/core-libraries-committee/issues/237)) * Fix `fdIsNonBlocking` to always be `0` for regular files and block devices on unix, regardless of `O_NONBLOCK`@@ -49,7 +86,6 @@ * Implement `many` and `some` methods of `instance Alternative (Compose f g)` explicitly. ([CLC proposal #181](https://github.com/haskell/core-libraries-committee/issues/181)) * Change the types of the `GHC.Stack.StackEntry.closureType` and `GHC.InfoProv.InfoProv.ipDesc` record fields to use `GHC.Exts.Heap.ClosureType` rather than an `Int`. To recover the old value use `fromEnum`. ([CLC proposal #210](https://github.com/haskell/core-libraries-committee/issues/210))- * The functions `GHC.Exts.dataToTag#` and `GHC.Base.getTag` have had their types changed to the following: @@ -64,22 +100,23 @@ matches a `data` or `data instance` declaration) with all of its constructors in scope and the levity of `t` is statically known, then the constraint `DataToTag t` can always be solved.+ ([CLC proposal #104](https://github.com/haskell/core-libraries-committee/issues/104)) * `GHC.Exts` no longer exports the GHC-internal `whereFrom#` primop ([CLC proposal #214](https://github.com/haskell/core-libraries-committee/issues/214)) * `GHC.InfoProv.InfoProv` now provides a `ipUnitId :: String` field encoding the unit ID of the unit defining the info table ([CLC proposal #214](https://github.com/haskell/core-libraries-committee/issues/214))-- ([CLC proposal #104](https://github.com/haskell/core-libraries-committee/issues/104)) * Add `sortOn` to `Data.List.NonEmpty` ([CLC proposal #227](https://github.com/haskell/core-libraries-committee/issues/227))- * Add more instances for `Compose`: `Fractional`, `RealFrac`, `Floating`, `RealFloat` ([CLC proposal #226](https://github.com/haskell/core-libraries-committee/issues/226))- * Treat all FDs as "nonblocking" on wasm32 ([CLC proposal #234](https://github.com/haskell/core-libraries-committee/issues/234))- * Add `HeapByEra`, `eraSelector` and `automaticEraIncrement` to `GHC.RTS.Flags` to reflect the new RTS flags: `-he` profiling mode, `-he` selector and `--automatic-era-increment`. ([CLC proposal #254](https://github.com/haskell/core-libraries-committee/issues/254))+ * Document that certain modules are unstable and not meant to be consumed by the general public ([CLC proposal #146](https://github.com/haskell/core-libraries-committee/issues/146))+ * Add unaligned `Addr#` primops ([CLC proposal #154](https://github.com/haskell/core-libraries-committee/issues/154))+ * Deprecate `stgDoubleToWord{32,64}` and `stgWord{32,64}ToDouble` in favor of new primops `castDoubleToWord{32,64}#` and `castWord{32,64}ToDouble#` ([CLC proposal #253](https://github.com/haskell/core-libraries-committee/issues/253))+ * Add `unsafeThawByteArray#`, opposite to the existing `unsafeFreezeByteArray#` ([CLC proposal #184](https://github.com/haskell/core-libraries-committee/issues/184)) ## 4.19.0.0 *October 2023*+ * Shipped with GHC 9.8.1 * Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`. Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it. ([CLC proposal #87](https://github.com/haskell/core-libraries-committee/issues/87) and [#114](https://github.com/haskell/core-libraries-committee/issues/114))@@ -110,12 +147,15 @@ * Add more instances for `Compose`: `Enum`, `Bounded`, `Num`, `Real`, `Integral` ([CLC proposal #160](https://github.com/haskell/core-libraries-committee/issues/160)) * Make `(&)` representation polymorphic in the return type ([CLC proposal #158](https://github.com/haskell/core-libraries-committee/issues/158)) * Implement `GHC.IORef.atomicSwapIORef` via a new dedicated primop `atomicSwapMutVar#` ([CLC proposal #139](https://github.com/haskell/core-libraries-committee/issues/139))- * Change `BufferCodec` to use an unboxed implementation, while providing a compatibility layer using pattern synonyms. ([CLC proposal #134](https://github.com/haskell/core-libraries-committee/issues/134))+ * Change `BufferCodec` to use an unboxed implementation, while providing a compatibility layer using pattern synonyms. ([CLC proposal #134](https://github.com/haskell/core-libraries-committee/issues/134) and [#178](https://github.com/haskell/core-libraries-committee/issues/178)) * Add nominal role annotations to `SNat` / `SSymbol` / `SChar` ([CLC proposal #170](https://github.com/haskell/core-libraries-committee/issues/170)) * Make `Semigroup`'s `stimes` specializable. ([CLC proposal #8](https://github.com/haskell/core-libraries-committee/issues/8)) * Implement `copyBytes`, `fillBytes`, `moveBytes` and `stimes` for `Data.Array.Byte.ByteArray` using primops ([CLC proposal #188](https://github.com/haskell/core-libraries-committee/issues/188)) * Add rewrite rules for conversion between `Int64` / `Word64` and `Float` / `Double` on 64-bit architectures ([CLC proposal #203](https://github.com/haskell/core-libraries-committee/issues/203)). * `Generic` instances for tuples now expose `Unit`, `Tuple2`, `Tuple3`, ..., `Tuple64` as the actual names for tuple type constructors ([GHC proposal #475](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0475-tuple-syntax.rst)).+ * Reject `FilePath`s containing interior `NUL`s ([CLC proposal #144](https://github.com/haskell/core-libraries-committee/issues/144))+ * Add `GHC.JS.Foreign.Callback` module for JavaScript backend ([CLC proposal #150](https://github.com/haskell/core-libraries-committee/issues/150))+ * Generalize the type of `keepAlive#` and `touch#` ([CLC proposal #152](https://github.com/haskell/core-libraries-committee/issues/152)) ## 4.18.0.0 *March 2023* * Shipped with GHC 9.6.1@@ -369,13 +409,6 @@ and ```\x y -> complement (x `xor` y)```, respectively. - `oneBits :: FiniteBits a => a`, `oneBits = complement zeroBits`.-- * Various folding operations in `GHC.List` are now implemented via strict- folds:- - `sum`- - `product`- - `maximum`- - `minimum` ## 4.15.0.0 *Feb 2021*
src/Control/Category.hs view
@@ -11,9 +11,26 @@ -- module Control.Category- ( Category(..)+ ( -- * Class+ Category(..)++ -- * Combinators , (<<<) , (>>>)++ -- $namingConflicts ) where import GHC.Internal.Control.Category++-- $namingConflicts+--+-- == A note on naming conflicts+--+-- The methods from 'Category' conflict with 'Prelude.id' and 'Prelude..' from the+-- prelude; you will likely want to either import this module qualified, or hide the+-- prelude functions:+--+-- @+-- import "Prelude" hiding (id, (.))+-- @
src/Control/Exception.hs view
@@ -37,7 +37,10 @@ addExceptionContext, someExceptionContext, annotateIO,+ NoBacktrace(..), ExceptionWithContext(..),+ WhileHandling(..),+ -- * Concrete exception types IOException, ArithException(..),@@ -65,6 +68,7 @@ -- * Throwing exceptions throw, throwIO,+ rethrowIO, ioError, throwTo, -- * Catching Exceptions@@ -73,6 +77,7 @@ -- $catchall -- ** The @catch@ functions catch,+ catchNoPropagate, catches, Handler(..), catchJust,@@ -81,6 +86,7 @@ handleJust, -- ** The @try@ functions try,+ tryWithContext, tryJust, -- ** The @evaluate@ function evaluate,@@ -111,11 +117,11 @@ bracketOnError, finally, onException+ ) where import GHC.Internal.Control.Exception import GHC.Internal.Exception.Type-import GHC.Internal.IO (annotateIO) {- $catching
src/Control/Monad/IO/Class.hs view
@@ -14,61 +14,8 @@ -- Class of monads based on @IO@. ----------------------------------------------------------------------------- -module Control.Monad.IO.Class (- MonadIO(..)- ) where--import GHC.Internal.Base---- | Monads in which 'IO' computations may be embedded.--- Any monad built by applying a sequence of monad transformers to the--- 'IO' monad will be an instance of this class.------ Instances should satisfy the following laws, which state that 'liftIO'--- is a transformer of monads:------ * @'liftIO' . 'return' = 'return'@------ * @'liftIO' (m >>= f) = 'liftIO' m >>= ('liftIO' . f)@--class (Monad m) => MonadIO m where- -- | Lift a computation from the 'IO' monad.- -- This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations- -- (i.e. 'IO' is the base monad for the stack).- --- -- === __Example__- --- --- -- > import Control.Monad.Trans.State -- from the "transformers" library- -- >- -- > printState :: Show s => StateT s IO ()- -- > printState = do- -- > state <- get- -- > liftIO $ print state- --- --- -- Had we omitted @'liftIO'@, we would have ended up with this error:- --- -- > • Couldn't match type ‘IO’ with ‘StateT s IO’- -- > Expected type: StateT s IO ()- -- > Actual type: IO ()- --- -- The important part here is the mismatch between @StateT s IO ()@ and @'IO' ()@.- --- -- Luckily, we know of a function that takes an @'IO' a@ and returns an @(m a)@: @'liftIO'@,- -- enabling us to run the program and see the expected results:- --- -- @- -- > evalStateT printState "hello"- -- "hello"- --- -- > evalStateT printState 3- -- 3- -- @- --- liftIO :: IO a -> m a---- | @since 4.9.0.0-instance MonadIO IO where- liftIO = id+module Control.Monad.IO.Class+ ( MonadIO(..) )+ where +import GHC.Internal.Control.Monad.IO.Class
src/Control/Monad/Zip.hs view
@@ -16,125 +16,6 @@ -- ----------------------------------------------------------------------------- -module Control.Monad.Zip where--import GHC.Internal.Control.Monad (liftM, liftM2)-import GHC.Internal.Data.Functor.Identity-import qualified GHC.Internal.Data.Functor-import GHC.Internal.Data.Monoid-import GHC.Internal.Data.Ord ( Down(..) )-import GHC.Internal.Data.Proxy-import qualified Data.List.NonEmpty as NE-import GHC.Generics-import GHC.Tuple (Solo (..))-import Prelude---- | Instances should satisfy the laws:------ [Naturality]------ @'liftM' (f 'Control.Arrow.***' g) ('mzip' ma mb)--- = 'mzip' ('liftM' f ma) ('liftM' g mb)@------ [Information Preservation]------ @'liftM' ('Prelude.const' ()) ma = 'liftM' ('Prelude.const' ()) mb@--- implies--- @'munzip' ('mzip' ma mb) = (ma, mb)@----class Monad m => MonadZip m where- {-# MINIMAL mzip | mzipWith #-}-- mzip :: m a -> m b -> m (a,b)- mzip = mzipWith (,)-- mzipWith :: (a -> b -> c) -> m a -> m b -> m c- mzipWith f ma mb = liftM (uncurry f) (mzip ma mb)-- munzip :: m (a,b) -> (m a, m b)- munzip mab = (liftM fst mab, liftM snd mab)- -- munzip is a member of the class because sometimes- -- you can implement it more efficiently than the- -- above default code. See #4370 comment by giorgidze---- | @since 4.3.1.0-instance MonadZip [] where- mzip = zip- mzipWith = zipWith- munzip = unzip---- | @since 4.9.0.0-instance MonadZip NE.NonEmpty where- mzip = NE.zip- mzipWith = NE.zipWith- munzip = GHC.Internal.Data.Functor.unzip---- | @since 4.8.0.0-instance MonadZip Identity where- mzipWith = liftM2- munzip (Identity (a, b)) = (Identity a, Identity b)---- | @since 4.15.0.0-instance MonadZip Solo where- mzipWith = liftM2- munzip (MkSolo (a, b)) = (MkSolo a, MkSolo b)---- | @since 4.8.0.0-instance MonadZip Dual where- -- Cannot use coerce, it's unsafe- mzipWith = liftM2---- | @since 4.8.0.0-instance MonadZip Sum where- mzipWith = liftM2---- | @since 4.8.0.0-instance MonadZip Product where- mzipWith = liftM2---- | @since 4.8.0.0-instance MonadZip Maybe where- mzipWith = liftM2---- | @since 4.8.0.0-instance MonadZip First where- mzipWith = liftM2---- | @since 4.8.0.0-instance MonadZip Last where- mzipWith = liftM2---- | @since 4.8.0.0-instance MonadZip f => MonadZip (Alt f) where- mzipWith f (Alt ma) (Alt mb) = Alt (mzipWith f ma mb)---- | @since 4.9.0.0-instance MonadZip Proxy where- mzipWith _ _ _ = Proxy---- Instances for GHC.Generics--- | @since 4.9.0.0-instance MonadZip U1 where- mzipWith _ _ _ = U1---- | @since 4.9.0.0-instance MonadZip Par1 where- mzipWith = liftM2---- | @since 4.9.0.0-instance MonadZip f => MonadZip (Rec1 f) where- mzipWith f (Rec1 fa) (Rec1 fb) = Rec1 (mzipWith f fa fb)---- | @since 4.9.0.0-instance MonadZip f => MonadZip (M1 i c f) where- mzipWith f (M1 fa) (M1 fb) = M1 (mzipWith f fa fb)---- | @since 4.9.0.0-instance (MonadZip f, MonadZip g) => MonadZip (f :*: g) where- mzipWith f (x1 :*: y1) (x2 :*: y2) = mzipWith f x1 x2 :*: mzipWith f y1 y2---- instances for GHC.Internal.Data.Ord+module Control.Monad.Zip ( MonadZip(..) ) where --- | @since 4.12.0.0-instance MonadZip Down where- mzipWith = liftM2+import GHC.Internal.Control.Monad.Zip(MonadZip(..))
src/Data/Array/Byte.hs view
@@ -13,6 +13,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE UnboxedTuples #-}+{-# LANGUAGE TemplateHaskellQuotes #-} module Data.Array.Byte ( ByteArray(..),@@ -30,6 +31,9 @@ import GHC.Internal.Show (intToDigit) import GHC.Internal.ST (ST(..), runST) import GHC.Internal.Word (Word8(..))+import GHC.Internal.TH.Syntax+import GHC.Internal.TH.Lift+import GHC.Internal.ForeignPtr import Prelude -- | Lifted wrapper for 'ByteArray#'.@@ -41,6 +45,22 @@ -- but wrap and unwrap 'ByteArray' internally as they please -- and use functions from "GHC.Exts". --+-- The memory representation of a 'ByteArray' is:+--+-- > ╭─────────────┬───╮ ╭────────┬──────┬─────────╮+-- > │ Constructor │ * ┼─►│ Header │ Size │ Payload │+-- > ╰─────────────┴───╯ ╰────────┴──────┴─────────╯+--+-- And its overhead is the following:+--+-- * 'ByteArray' constructor: 1 word+-- * Pointer to 'ByteArray#': 1 word+-- * 'ByteArray#' Header: 1 word+-- * 'ByteArray#' Size: 1 word+--+-- Where a word is the unit of heap allocation,+-- measuring 8 bytes on 64-bit systems, and 4 bytes on 32-bit systems.+-- -- @since 4.17.0.0 data ByteArray = ByteArray ByteArray# @@ -179,6 +199,34 @@ where comma | i == 0 = id | otherwise = showString ", "++instance Lift ByteArray where+ liftTyped = unsafeCodeCoerce . lift+ lift (ByteArray b) =+ [| addrToByteArray $(lift len)+ $(pure . LitE . BytesPrimL $ Bytes ptr 0 (fromIntegral len))+ |]+ where+ len# = sizeofByteArray# b+ len = I# len#+ pb :: ByteArray#+ !(ByteArray pb)+ | isTrue# (isByteArrayPinned# b) = ByteArray b+ | otherwise = runST $ ST $+ \s -> case newPinnedByteArray# len# s of+ (# s', mb #) -> case copyByteArray# b 0# mb 0# len# s' of+ s'' -> case unsafeFreezeByteArray# mb s'' of+ (# s''', ret #) -> (# s''', ByteArray ret #)+ ptr :: ForeignPtr Word8+ ptr = ForeignPtr (byteArrayContents# pb) (PlainPtr (unsafeCoerce# pb))++{-# NOINLINE addrToByteArray #-}+addrToByteArray :: Int -> Addr# -> ByteArray+addrToByteArray (I# len) addr = runST $ ST $+ \s -> case newByteArray# len s of+ (# s', mb #) -> case copyAddrToByteArray# addr mb 0# len s' of+ s'' -> case unsafeFreezeByteArray# mb s'' of+ (# s''', ret #) -> (# s''', ByteArray ret #) -- | Compare prefixes of given length. compareByteArraysFromBeginning :: ByteArray -> ByteArray -> Int -> Ordering
src/Data/Bifoldable.hs view
@@ -238,8 +238,8 @@ -- -- >>> bifoldr (flip const) (:) [] (undefined :: (Int, Word)) `seq` () -- ()--- >>> foldr (:) [] (undefined :: (Int, Word)) `seq` ()--- *** Exception: Prelude.undefined+-- >>> foldr (:) [] (errorWithoutStackTrace "error!" :: (Int, Word)) `seq` ()+-- *** Exception: error! -- -- @since 4.10.0.0 instance Bifoldable (,) where@@ -640,7 +640,13 @@ biconcat :: Bifoldable t => t [a] [a] -> [a] biconcat = bifold --- | The largest element of a non-empty structure.+-- | The largest element of a non-empty structure. This function is equivalent+-- to @'bifoldr1' 'max'@, and its behavior on structures with multiple largest+-- elements depends on the relevant implementation of 'max'. For the default+-- implementation of 'max' (@max x y = if x <= y then y else x@), structure+-- order is used as a tie-breaker: if there are multiple largest elements, the+-- rightmost of them is chosen (this is equivalent to @'bimaximumBy'+-- 'compare'@). -- -- ==== __Examples__ --@@ -670,7 +676,13 @@ getMax . bifoldMap mj mj where mj = Max #. (Just :: a -> Maybe a) --- | The least element of a non-empty structure.+-- | The least element of a non-empty structure. This function is equivalent to+-- @'bifoldr1' 'min'@, and its behavior on structures with multiple least+-- elements depends on the relevant implementation of 'min'. For the default+-- implementation of 'min' (@min x y = if x <= y then x else y@), structure+-- order is used as a tie-breaker: if there are multiple least elements, the+-- leftmost of them is chosen (this is equivalent to @'biminimumBy'+-- 'compare'@). -- -- ==== __Examples__ --@@ -927,7 +939,8 @@ biall p q = getAll #. bifoldMap (All . p) (All . q) -- | The largest element of a non-empty structure with respect to the--- given comparison function.+-- given comparison function. Structure order is used as a tie-breaker: if+-- there are multiple largest elements, the rightmost of them is chosen. -- -- ==== __Examples__ --@@ -956,7 +969,8 @@ _ -> y -- | The least element of a non-empty structure with respect to the--- given comparison function.+-- given comparison function. Structure order is used as a tie-breaker: if+-- there are multiple least elements, the leftmost of them is chosen. -- -- ==== __Examples__ --
src/Data/Bifunctor.hs view
@@ -140,8 +140,8 @@ -- () -- >>> second id (undefined :: (Int, Word)) `seq` () -- ()--- >>> id (undefined :: (Int, Word)) `seq` ()--- *** Exception: Prelude.undefined+-- >>> id (errorWithoutStackTrace "error!" :: (Int, Word)) `seq` ()+-- *** Exception: error! -- -- @since 4.8.0.0 instance Bifunctor (,) where
src/Data/Bitraversable.hs view
@@ -18,6 +18,8 @@ , bisequenceA , bisequence , bimapM+ , firstA+ , secondA , bifor , biforM , bimapAccumL@@ -172,6 +174,60 @@ bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b) bisequence = bitraverse id id +-- | Traverses only over the first argument.+--+-- @'firstA' f ≡ 'bitraverse' f 'pure'@++-- ==== __Examples__+--+-- Basic usage:+--+-- >>> firstA listToMaybe (Left [])+-- Nothing+--+-- >>> firstA listToMaybe (Left [1, 2, 3])+-- Just (Left 1)+--+-- >>> firstA listToMaybe (Right [4, 5])+-- Just (Right [4, 5])+--+-- >>> firstA listToMaybe ([1, 2, 3], [4, 5])+-- Just (1,[4, 5])+--+-- >>> firstA listToMaybe ([], [4, 5])+-- Nothing++-- @since 4.21.0.0+firstA :: Bitraversable t => Applicative f => (a -> f c) -> t a b -> f (t c b)+firstA f = bitraverse f pure++-- | Traverses only over the second argument.+--+-- @'secondA' f ≡ 'bitraverse' 'pure' f@+--+-- ==== __Examples__+--+-- Basic usage:+--+-- >>> secondA (find odd) (Left [])+-- Just (Left [])+--+-- >>> secondA (find odd) (Left [1, 2, 3])+-- Just (Left [1,2,3])+--+-- >>> secondA (find odd) (Right [4, 5])+-- Just (Right 5)+--+-- >>> secondA (find odd) ([1, 2, 3], [4, 5])+-- Just ([1,2,3],5)+--+-- >>> secondA (find odd) ([1,2,3], [4])+-- Nothing+--+-- @since 4.21.0.0+secondA :: Bitraversable t => Applicative f => (b -> f c) -> t a b -> f (t a c)+secondA f = bitraverse pure f+ -- | Class laws for tuples hold only up to laziness. The -- Bitraversable methods are lazier than their Traversable counterparts. -- For example the law @'bitraverse' 'pure' ≡ 'traverse'@ does@@ -179,8 +235,8 @@ -- -- >>> (bitraverse pure pure undefined :: IO (Int, Word)) `seq` () -- ()--- >>> (traverse pure undefined :: IO (Int, Word)) `seq` ()--- *** Exception: Prelude.undefined+-- >>> (traverse pure (errorWithoutStackTrace "error!") :: IO (Int, Word)) `seq` ()+-- *** Exception: error! -- -- @since 4.10.0.0 instance Bitraversable (,) where
+ src/Data/Bounded.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE Safe #-}+{-# LANGUAGE NoImplicitPrelude #-}++-----------------------------------------------------------------------------+-- |+-- Module : Data.Bounded+-- Copyright : (c) The University of Glasgow, 1992-2002+-- License : see libraries/base/LICENSE+--+-- Maintainer : cvs-ghc@haskell.org+-- Stability : stable+-- Portability : non-portable (GHC extensions)+--+-- The 'Bounded' class.+--+-- @since 4.22.0.0+--+-----------------------------------------------------------------------------++module Data.Bounded+ ( Bounded(..)+ ) where++import GHC.Enum+
src/Data/Complex.hs view
@@ -47,6 +47,9 @@ infix 6 :+ +-- $setup+-- >>> import Prelude+ -- ----------------------------------------------------------------------------- -- The Complex type @@ -62,7 +65,7 @@ -- it holds that @z == 'abs' z * 'signum' z@. -- -- Note that `Complex`'s instances inherit the deficiencies from the type--- parameter's. For example, @Complex Float@'s 'Ord' instance has similar+-- parameter's. For example, @Complex Float@'s 'Eq' instance has similar -- problems to `Float`'s. -- -- As can be seen in the examples, the 'Foldable'@@ -85,6 +88,7 @@ -- >>> mapM print (1 :+ 2) -- 1 -- 2+-- () :+ () data Complex a = !a :+ !a -- ^ forms a complex number from its real and imaginary -- rectangular components.
src/Data/Enum.hs view
@@ -1,7 +1,8 @@ {-# LANGUAGE Safe #-}+{-# LANGUAGE NoImplicitPrelude #-} +----------------------------------------------------------------------------- -- |--- -- Module : Data.Enum -- Copyright : (c) The University of Glasgow, 1992-2002 -- License : see libraries/base/LICENSE@@ -10,12 +11,16 @@ -- Stability : stable -- Portability : non-portable (GHC extensions) ----- The 'Enum' and 'Bounded' classes.+-- The 'Enum' class. --+-- @since 4.20.0.0+--+----------------------------------------------------------------------------- module Data.Enum- (Bounded(..),- Enum(..)- ) where+ ( Enum(..)+ , {-# DEPRECATED "Bounded should be imported from Data.Bounded" #-}+ Bounded(..)+ ) where -import GHC.Internal.Data.Enum+import GHC.Internal.Enum
src/Data/Fixed.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE TemplateHaskellQuotes #-} ----------------------------------------------------------------------------- -- |@@ -90,9 +91,14 @@ import GHC.Internal.Read import GHC.Internal.Text.ParserCombinators.ReadPrec import GHC.Internal.Text.Read.Lex+import qualified GHC.Internal.TH.Syntax as TH+import qualified GHC.Internal.TH.Lift as TH import Data.Typeable import Prelude +-- $setup+-- >>> import Prelude+ default () -- avoid any defaulting shenanigans -- | Generalisation of 'div' to any instance of 'Real'@@ -136,6 +142,13 @@ gunfold k z _ = k (z MkFixed) dataTypeOf _ = tyFixed toConstr _ = conMkFixed++-- |+-- @since template-haskell-2.19.0.0+-- @since base-4.21.0.0+instance TH.Lift (Fixed a) where+ liftTyped x = TH.unsafeCodeCoerce (TH.lift x)+ lift (MkFixed x) = [| MkFixed x |] -- | Types which can be used as a resolution argument to the 'Fixed' type constructor must implement the 'HasResolution' typeclass. class HasResolution (a :: k) where
src/Data/Foldable.hs view
@@ -98,6 +98,10 @@ import GHC.Internal.Data.Foldable +-- $setup+-- >>> import Prelude+-- >>> import qualified Data.List as List+ -- $overview -- -- #overview#@@ -141,7 +145,7 @@ -- -- >>> foldl' (+) 0 [1..100] -- 5050--- >>> foldr (&&) True (repeat False)+-- >>> foldr (&&) True (List.repeat False) -- False -- -- The first argument of both is an explicit /operator/ that merges the@@ -405,7 +409,7 @@ -- segment. -- -- >>> myconcat = foldr (\x z -> foldr (:) z x) []--- >>> take 15 $ myconcat $ map (\i -> [0..i]) [0..]+-- >>> List.take 15 $ myconcat $ List.map (\i -> [0..i]) [0..] -- [0,0,1,0,1,2,0,1,2,3,0,1,2,3,4] -- -- Of course in this case another way to achieve the same result is via a@@ -536,13 +540,13 @@ -- then the evaluated effects will be from an initial portion of the -- element sequence. ----- >>> :set -XBangPatterns--- >>> import Control.Monad--- >>> import Control.Monad.Trans.Class--- >>> import Control.Monad.Trans.Maybe--- >>> import Data.Foldable--- >>> let f !_ e = when (e > 3) mzero >> lift (print e)--- >>> runMaybeT $ foldlM f () [0..]+-- > :set -XBangPatterns+-- > import Control.Monad+-- > import Control.Monad.Trans.Class+-- > import Control.Monad.Trans.Maybe+-- > import Data.Foldable+-- > let f !_ e = when (e > 3) mzero >> lift (print e)+-- > runMaybeT $ foldlM f () [0..] -- 0 -- 1 -- 2@@ -553,16 +557,16 @@ -- to left, and therefore diverges when folding an unbounded input -- structure without ever having the opportunity to short-circuit. ----- >>> let f e _ = when (e > 3) mzero >> lift (print e)--- >>> runMaybeT $ foldrM f () [0..]+-- > let f e _ = when (e > 3) mzero >> lift (print e)+-- > runMaybeT $ foldrM f () [0..] -- ...hangs... -- -- When the structure is finite `foldrM` performs the monadic effects from -- right to left, possibly short-circuiting after processing a tail portion -- of the element sequence. ----- >>> let f e _ = when (e < 3) mzero >> lift (print e)--- >>> runMaybeT $ foldrM f () [0..5]+-- > let f e _ = when (e < 3) mzero >> lift (print e)+-- > runMaybeT $ foldrM f () [0..5] -- 5 -- 4 -- 3@@ -614,14 +618,16 @@ -- Below we construct a @Foldable@ instance for a data type representing a -- (finite) binary tree with depth-first traversal. ----- > data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)+-- >>> data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) -- -- a suitable instance would be: ----- > instance Foldable Tree where--- > foldr f z Empty = z--- > foldr f z (Leaf x) = f x z--- > foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l+-- >>> :{+-- instance Foldable Tree where+-- foldr f z Empty = z+-- foldr f z (Leaf x) = f x z+-- foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l+-- :} -- -- The 'Node' case is a right fold of the left subtree whose initial -- value is a right fold of the rest of the tree.
src/Data/Foldable1.hs view
@@ -61,6 +61,9 @@ -- $setup -- >>> import Prelude hiding (foldr1, foldl1, head, last, minimum, maximum)+-- >>> import Data.List.NonEmpty (NonEmpty(..))+-- >>> import Data.Monoid (Sum(..))+-- >>> import Data.Functor.Identity ------------------------------------------------------------------------------- -- Foldable1 type class@@ -127,7 +130,13 @@ toNonEmpty :: t a -> NonEmpty a toNonEmpty = runNonEmptyDList . foldMap1 singleton - -- | The largest element of a non-empty structure.+ -- | The largest element of a non-empty structure. This function is+ -- equivalent to @'foldr1' 'Data.Ord.max'@, and its behavior on structures+ -- with multiple largest elements depends on the relevant implementation of+ -- 'Data.Ord.max'. For the default implementation of 'Data.Ord.max' (@max x+ -- y = if x <= y then y else x@), structure order is used as a tie-breaker:+ -- if there are multiple largest elements, the rightmost of them is chosen+ -- (this is equivalent to @'maximumBy' 'Data.Ord.compare'@). -- -- >>> maximum (32 :| [64, 8, 128, 16]) -- 128@@ -136,7 +145,13 @@ maximum :: Ord a => t a -> a maximum = getMax #. foldMap1' Max - -- | The least element of a non-empty structure.+ -- | The least element of a non-empty structure. This function is+ -- equivalent to @'foldr1' 'Data.Ord.min'@, and its behavior on structures+ -- with multiple largest elements depends on the relevant implementation of+ -- 'Data.Ord.min'. For the default implementation of 'Data.Ord.min' (@min x+ -- y = if x <= y then x else y@), structure order is used as a tie-breaker:+ -- if there are multiple least elements, the leftmost of them is chosen+ -- (this is equivalent to @'minimumBy' 'Data.Ord.compare'@). -- -- >>> minimum (32 :| [64, 8, 128, 16]) -- 8@@ -359,7 +374,8 @@ where x:|xs = toNonEmpty t -- | The largest element of a non-empty structure with respect to the--- given comparison function.+-- given comparison function. Structure order is used as a tie-breaker: if+-- there are multiple largest elements, the rightmost of them is chosen. -- -- @since 4.18.0.0 maximumBy :: Foldable1 t => (a -> a -> Ordering) -> t a -> a@@ -369,7 +385,8 @@ _ -> y -- | The least element of a non-empty structure with respect to the--- given comparison function.+-- given comparison function. Structure order is used as a tie-breaker: if+-- there are multiple least elements, the leftmost of them is chosen. -- -- @since 4.18.0.0 minimumBy :: Foldable1 t => (a -> a -> Ordering) -> t a -> a
src/Data/Functor.hs view
@@ -11,32 +11,9 @@ -- Portability : portable -- ----- A type @f@ is a Functor if it provides a function @fmap@ which, given any types @a@ and @b@,+-- A type @f@ is a Functor if it provides a function 'fmap' which, given any types @a@ and @b@, -- lets you apply any function of type @(a -> b)@ to turn an @f a@ into an @f b@, preserving the -- structure of @f@.------ ==== __Examples__------ >>> fmap show (Just 1) -- (a -> b) -> f a -> f b--- Just "1" -- (Int -> String) -> Maybe Int -> Maybe String------ >>> fmap show Nothing -- (a -> b) -> f a -> f b--- Nothing -- (Int -> String) -> Maybe Int -> Maybe String------ >>> fmap show [1,2,3] -- (a -> b) -> f a -> f b--- ["1","2","3"] -- (Int -> String) -> [Int] -> [String]------ >>> fmap show [] -- (a -> b) -> f a -> f b--- [] -- (Int -> String) -> [Int] -> [String]------ The 'fmap' function is also available as the infix operator '<$>':------ >>> fmap show (Just 1) -- (Int -> String) -> Maybe Int -> Maybe String--- Just "1"------ >>> show <$> (Just 1) -- (Int -> String) -> Maybe Int -> Maybe String--- Just "1"- module Data.Functor (Functor(..), ($>),
src/Data/Functor/Classes.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE Safe #-}@@ -78,12 +79,13 @@ import GHC.Internal.Data.Ord (Down(Down)) import Data.Complex (Complex((:+))) -import GHC.Generics (Generic1(..), Generically1(..))+import GHC.Generics (Generic1(..), Generically1(..), V1, U1(..), Par1(..), Rec1(..), K1(..), M1(..) , (:+:)(..), (:*:)(..), (:.:)(..), URec(..), UAddr, UChar, UDouble, UFloat, UInt, UWord) import GHC.Tuple (Solo (..))-import GHC.Internal.Read (expectP, list, paren)+import GHC.Internal.Read (expectP, list, paren, readField)+import GHC.Internal.Show (appPrec) -import GHC.Internal.Text.ParserCombinators.ReadPrec (ReadPrec, readPrec_to_S, readS_to_Prec)-import GHC.Internal.Text.Read (Read(..), parens, prec, step)+import GHC.Internal.Text.ParserCombinators.ReadPrec (ReadPrec, readPrec_to_S, readS_to_Prec, pfail)+import GHC.Internal.Text.Read (Read(..), parens, prec, step, reset) import GHC.Internal.Text.Read.Lex (Lexeme(..)) import GHC.Internal.Text.Show (showListWith) import Prelude@@ -1123,3 +1125,322 @@ > showsBinaryWith sp (liftShowsPrec sp sl) "Two" d x y -}++-- | @since base-4.21.0.0+instance Eq1 V1 where+ liftEq _ = \_ _ -> True++-- | @since base-4.21.0.0+instance Ord1 V1 where+ liftCompare _ = \_ _ -> EQ++-- | @since base-4.21.0.0+instance Show1 V1 where+ liftShowsPrec _ _ _ = \_ -> showString "V1"++-- | @since base-4.21.0.0+instance Read1 V1 where+ liftReadsPrec _ _ = readPrec_to_S pfail+ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance Eq1 U1 where+ liftEq _ = \_ _ -> True++-- | @since base-4.21.0.0+instance Ord1 U1 where+ liftCompare _ = \_ _ -> EQ++-- | @since base-4.21.0.0+instance Show1 U1 where+ liftShowsPrec _ _ _ = \U1 -> showString "U1"++-- | @since base-4.21.0.0+instance Read1 U1 where+ liftReadPrec _ _ =+ parens (expectP (Ident "U1") *> pure U1)++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance Eq1 Par1 where+ liftEq eq = \(Par1 a) (Par1 a') -> eq a a'++-- | @since base-4.21.0.0+instance Ord1 Par1 where+ liftCompare cmp = \(Par1 a) (Par1 a') -> cmp a a'++-- | @since base-4.21.0.0+instance Show1 Par1 where+ liftShowsPrec sp _ d = \(Par1 { unPar1 = a }) ->+ showsSingleFieldRecordWith sp "Par1" "unPar1" d a++-- | @since base-4.21.0.0+instance Read1 Par1 where+ liftReadPrec rp _ =+ readsSingleFieldRecordWith rp "Par1" "unPar1" Par1++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance Eq1 f => Eq1 (Rec1 f) where+ liftEq eq = \(Rec1 a) (Rec1 a') -> liftEq eq a a'++-- | @since base-4.21.0.0+instance Ord1 f => Ord1 (Rec1 f) where+ liftCompare cmp = \(Rec1 a) (Rec1 a') -> liftCompare cmp a a'++-- | @since base-4.21.0.0+instance Show1 f => Show1 (Rec1 f) where+ liftShowsPrec sp sl d = \(Rec1 { unRec1 = a }) ->+ showsSingleFieldRecordWith (liftShowsPrec sp sl) "Rec1" "unRec1" d a++-- | @since base-4.21.0.0+instance Read1 f => Read1 (Rec1 f) where+ liftReadPrec rp rl =+ readsSingleFieldRecordWith (liftReadPrec rp rl) "Rec1" "unRec1" Rec1++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance Eq c => Eq1 (K1 i c) where+ liftEq _ = \(K1 a) (K1 a') -> a == a'++-- | @since base-4.21.0.0+instance Ord c => Ord1 (K1 i c) where+ liftCompare _ = \(K1 a) (K1 a') -> compare a a'++-- | @since base-4.21.0.0+instance Show c => Show1 (K1 i c) where+ liftShowsPrec _ _ d = \(K1 { unK1 = a }) ->+ showsSingleFieldRecordWith showsPrec "K1" "unK1" d a++-- | @since base-4.21.0.0+instance Read c => Read1 (K1 i c) where+ liftReadPrec _ _ = readData $+ readsSingleFieldRecordWith readPrec "K1" "unK1" K1++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance Eq1 f => Eq1 (M1 i c f) where+ liftEq eq = \(M1 a) (M1 a') -> liftEq eq a a'++-- | @since base-4.21.0.0+instance Ord1 f => Ord1 (M1 i c f) where+ liftCompare cmp = \(M1 a) (M1 a') -> liftCompare cmp a a'++-- | @since base-4.21.0.0+instance Show1 f => Show1 (M1 i c f) where+ liftShowsPrec sp sl d = \(M1 { unM1 = a }) ->+ showsSingleFieldRecordWith (liftShowsPrec sp sl) "M1" "unM1" d a++-- | @since base-4.21.0.0+instance Read1 f => Read1 (M1 i c f) where+ liftReadPrec rp rl = readData $+ readsSingleFieldRecordWith (liftReadPrec rp rl) "M1" "unM1" M1++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance (Eq1 f, Eq1 g) => Eq1 (f :+: g) where+ liftEq eq = \lhs rhs -> case (lhs, rhs) of+ (L1 a, L1 a') -> liftEq eq a a'+ (R1 b, R1 b') -> liftEq eq b b'+ _ -> False++-- | @since base-4.21.0.0+instance (Ord1 f, Ord1 g) => Ord1 (f :+: g) where+ liftCompare cmp = \lhs rhs -> case (lhs, rhs) of+ (L1 _, R1 _) -> LT+ (R1 _, L1 _) -> GT+ (L1 a, L1 a') -> liftCompare cmp a a'+ (R1 b, R1 b') -> liftCompare cmp b b'++-- | @since base-4.21.0.0+instance (Show1 f, Show1 g) => Show1 (f :+: g) where+ liftShowsPrec sp sl d = \x -> case x of+ L1 a -> showsUnaryWith (liftShowsPrec sp sl) "L1" d a+ R1 b -> showsUnaryWith (liftShowsPrec sp sl) "R1" d b++-- | @since base-4.21.0.0+instance (Read1 f, Read1 g) => Read1 (f :+: g) where+ liftReadPrec rp rl = readData $+ readUnaryWith (liftReadPrec rp rl) "L1" L1 <|>+ readUnaryWith (liftReadPrec rp rl) "R1" R1++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance (Eq1 f, Eq1 g) => Eq1 (f :*: g) where+ liftEq eq = \(f :*: g) (f' :*: g') -> liftEq eq f f' && liftEq eq g g'++-- | @since base-4.21.0.0+instance (Ord1 f, Ord1 g) => Ord1 (f :*: g) where+ liftCompare cmp = \(f :*: g) (f' :*: g') -> liftCompare cmp f f' <> liftCompare cmp g g'++-- | @since base-4.21.0.0+instance (Show1 f, Show1 g) => Show1 (f :*: g) where+ liftShowsPrec sp sl d = \(a :*: b) ->+ showsBinaryOpWith+ (liftShowsPrec sp sl)+ (liftShowsPrec sp sl)+ 7+ ":*:"+ d+ a+ b++-- | @since base-4.21.0.0+instance (Read1 f, Read1 g) => Read1 (f :*: g) where+ liftReadPrec rp rl = parens $ prec 6 $+ readBinaryOpWith (liftReadPrec rp rl) (liftReadPrec rp rl) ":*:" (:*:)++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance (Eq1 f, Eq1 g) => Eq1 (f :.: g) where+ liftEq eq = \(Comp1 a) (Comp1 a') -> liftEq (liftEq eq) a a'++-- | @since base-4.21.0.0+instance (Ord1 f, Ord1 g) => Ord1 (f :.: g) where+ liftCompare cmp = \(Comp1 a) (Comp1 a') -> liftCompare (liftCompare cmp) a a'++-- | @since base-4.21.0.0+instance (Show1 f, Show1 g) => Show1 (f :.: g) where+ liftShowsPrec sp sl d = \(Comp1 { unComp1 = a }) ->+ showsSingleFieldRecordWith+ (liftShowsPrec (liftShowsPrec sp sl) (liftShowList sp sl))+ "Comp1"+ "unComp1"+ d+ a++-- | @since base-4.21.0.0+instance (Read1 f, Read1 g) => Read1 (f :.: g) where+ liftReadPrec rp rl = readData $+ readsSingleFieldRecordWith+ (liftReadPrec (liftReadPrec rp rl) (liftReadListPrec rp rl))+ "Comp1"+ "unComp1"+ Comp1++ liftReadListPrec = liftReadListPrecDefault+ liftReadList = liftReadListDefault++-- | @since base-4.21.0.0+instance Eq1 UAddr where+ -- NB cannot use eqAddr# because its module isn't safe+ liftEq _ = \(UAddr a) (UAddr b) -> UAddr a == UAddr b++-- | @since base-4.21.0.0+instance Ord1 UAddr where+ liftCompare _ = \(UAddr a) (UAddr b) -> compare (UAddr a) (UAddr b)++-- | @since base-4.21.0.0+instance Show1 UAddr where+ liftShowsPrec _ _ = showsPrec++-- NB no Read1 for URec (Ptr ()) because there's no Read for Ptr.++-- | @since base-4.21.0.0+instance Eq1 UChar where+ liftEq _ = \(UChar a) (UChar b) -> UChar a == UChar b++-- | @since base-4.21.0.0+instance Ord1 UChar where+ liftCompare _ = \(UChar a) (UChar b) -> compare (UChar a) (UChar b)++-- | @since base-4.21.0.0+instance Show1 UChar where+ liftShowsPrec _ _ = showsPrec++-- | @since base-4.21.0.0+instance Eq1 UDouble where+ liftEq _ = \(UDouble a) (UDouble b) -> UDouble a == UDouble b++-- | @since base-4.21.0.0+instance Ord1 UDouble where+ liftCompare _ = \(UDouble a) (UDouble b) -> compare (UDouble a) (UDouble b)++-- | @since base-4.21.0.0+instance Show1 UDouble where+ liftShowsPrec _ _ = showsPrec++-- | @since base-4.21.0.0+instance Eq1 UFloat where+ liftEq _ = \(UFloat a) (UFloat b) -> UFloat a == UFloat b++-- | @since base-4.21.0.0+instance Ord1 UFloat where+ liftCompare _ = \(UFloat a) (UFloat b) -> compare (UFloat a) (UFloat b)++-- | @since base-4.21.0.0+instance Show1 UFloat where+ liftShowsPrec _ _ = showsPrec++-- | @since base-4.21.0.0+instance Eq1 UInt where+ liftEq _ = \(UInt a) (UInt b) -> UInt a == UInt b++-- | @since base-4.21.0.0+instance Ord1 UInt where+ liftCompare _ = \(UInt a) (UInt b) -> compare (UInt a) (UInt b)++-- | @since base-4.21.0.0+instance Show1 UInt where+ liftShowsPrec _ _ = showsPrec++-- | @since base-4.21.0.0+instance Eq1 UWord where+ liftEq _ = \(UWord a) (UWord b) -> UWord a == UWord b++-- | @since base-4.21.0.0+instance Ord1 UWord where+ liftCompare _ = \(UWord a) (UWord b) -> compare (UWord a) (UWord b)++-- | @since base-4.21.0.0+instance Show1 UWord where+ liftShowsPrec _ _ = showsPrec++showsSingleFieldRecordWith :: (Int -> a -> ShowS) -> String -> String -> Int -> a -> ShowS+showsSingleFieldRecordWith sp name field d x =+ showParen (d > appPrec) $+ showString name . showString " {" . showString field . showString " = " . sp 0 x . showChar '}'++readsSingleFieldRecordWith :: ReadPrec a -> String -> String -> (a -> t) -> ReadPrec t+readsSingleFieldRecordWith rp name field cons = parens $ prec 11 $ do+ expectP $ Ident name+ expectP $ Punc "{"+ x <- readField field $ reset rp+ expectP $ Punc "}"+ pure $ cons x++showsBinaryOpWith+ :: (Int -> a -> ShowS)+ -> (Int -> b -> ShowS)+ -> Int+ -> String+ -> Int+ -> a+ -> b+ -> ShowS+showsBinaryOpWith sp1 sp2 opPrec name d x y = showParen (d >= opPrec) $+ sp1 opPrec x . showChar ' ' . showString name . showChar ' ' . sp2 opPrec y++readBinaryOpWith+ :: ReadPrec a+ -> ReadPrec b+ -> String+ -> (a -> b -> t)+ -> ReadPrec t+readBinaryOpWith rp1 rp2 name cons =+ cons <$> step rp1 <* expectP (Symbol name) <*> step rp2
src/Data/Functor/Compose.hs view
@@ -40,6 +40,9 @@ infixr 9 `Compose` +-- $setup+-- >>> import Prelude+ -- | Right-to-left composition of functors. -- The composition of applicative functors is always applicative, -- but the composition of monads is not always a monad.
src/Data/Functor/Product.hs view
@@ -31,6 +31,9 @@ import GHC.Generics (Generic, Generic1) import Prelude +-- $setup+-- >>> import Prelude+ -- | Lifted product of functors. -- -- ==== __Examples__
src/Data/Functor/Sum.hs view
@@ -28,6 +28,9 @@ import GHC.Generics (Generic, Generic1) import Prelude +-- $setup+-- >>> import Prelude+ -- | Lifted sum of functors. -- -- ==== __Examples__
src/Data/List.hs view
@@ -26,6 +26,7 @@ singleton, null, length,+ compareLength, -- * List transformations map, reverse,@@ -83,7 +84,9 @@ stripPrefix, group, inits,+ inits1, tails,+ tails1, -- ** Predicates isPrefixOf, isSuffixOf,@@ -176,4 +179,106 @@ genericReplicate ) where +import GHC.Internal.Data.Bool (otherwise) import GHC.Internal.Data.List+import GHC.Internal.Data.List.NonEmpty (NonEmpty(..))+import GHC.Internal.Data.Ord (Ordering(..), (<), (>))+import GHC.Internal.Int (Int)+import GHC.Internal.Num ((-))+import GHC.List (build)++inits1, tails1 :: [a] -> [NonEmpty a]++-- | The 'inits1' function returns all non-empty initial segments of the+-- argument, shortest first.+--+-- @since 4.21.0.0+--+-- ==== __Laziness__+--+-- Note that 'inits1' has the following strictness property:+-- @inits1 (xs ++ _|_) = inits1 xs ++ _|_@+--+-- In particular,+-- @inits1 _|_ = _|_@+--+-- ==== __Examples__+--+-- >>> inits1 "abc"+-- ['a' :| "",'a' :| "b",'a' :| "bc"]+--+-- >>> inits1 []+-- []+--+-- inits1 is productive on infinite lists:+--+-- >>> take 3 $ inits1 [1..]+-- [1 :| [],1 :| [2],1 :| [2,3]]+inits1 [] = []+inits1 (x : xs) = map (x :|) (inits xs)++-- | \(\mathcal{O}(n)\). The 'tails1' function returns all non-empty final+-- segments of the argument, longest first.+--+-- @since 4.21.0.0+--+-- ==== __Laziness__+--+-- Note that 'tails1' has the following strictness property:+-- @tails1 _|_ = _|_@+--+-- >>> tails1 undefined+-- *** Exception: Prelude.undefined+--+-- >>> drop 1 (tails1 [undefined, 1, 2])+-- [1 :| [2],2 :| []]+--+-- ==== __Examples__+--+-- >>> tails1 "abc"+-- ['a' :| "bc",'b' :| "c",'c' :| ""]+--+-- >>> tails1 [1, 2, 3]+-- [1 :| [2,3],2 :| [3],3 :| []]+--+-- >>> tails1 []+-- []+{-# INLINABLE tails1 #-}+tails1 lst = build (\c n ->+ let tails1Go [] = n+ tails1Go (x : xs) = (x :| xs) `c` tails1Go xs+ in tails1Go lst)++-- | Use 'compareLength' @xs@ @n@ as a safer and faster alternative+-- to 'compare' ('length' @xs@) @n@. Similarly, it's better+-- to write @compareLength xs 10 == LT@ instead of @length xs < 10@.+--+-- While 'length' would force and traverse+-- the entire spine of @xs@ (which could even diverge if @xs@ is infinite),+-- 'compareLength' traverses at most @n@ elements to determine its result.+--+-- >>> compareLength [] 0+-- EQ+-- >>> compareLength [] 1+-- LT+-- >>> compareLength ['a'] 1+-- EQ+-- >>> compareLength ['a', 'b'] 1+-- GT+-- >>> compareLength [0..] 100+-- GT+-- >>> compareLength undefined (-1)+-- GT+-- >>> compareLength ('a' : undefined) 0+-- GT+--+-- @since 4.21.0.0+--+compareLength :: [a] -> Int -> Ordering+compareLength xs n+ | n < 0 = GT+ | otherwise = foldr+ (\_ f m -> if m > 0 then f (m - 1) else GT)+ (\m -> if m > 0 then LT else EQ)+ xs+ n
src/Data/List/NonEmpty.hs view
@@ -36,6 +36,7 @@ , sortWith -- :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a -- * Basic functions , length -- :: NonEmpty a -> Int+ , compareLength -- :: NonEmpty a -> Int -> Ordering , head -- :: NonEmpty a -> a , tail -- :: NonEmpty a -> [a] , last -- :: NonEmpty a -> a@@ -109,23 +110,55 @@ import qualified Prelude import Control.Applicative (Applicative (..), Alternative (many))+import qualified Data.List as List import GHC.Internal.Data.Foldable hiding (length, toList) import qualified GHC.Internal.Data.Foldable as Foldable import GHC.Internal.Data.Function (on)-import qualified GHC.Internal.Data.List as List import GHC.Internal.Data.Ord (comparing)-import GHC.Internal.Base (NonEmpty(..)) import GHC.Internal.Stack.Types (HasCallStack)+import GHC.Internal.Data.List.NonEmpty infixr 5 <| -- $setup--- >>> import Prelude (negate)+-- >>> import Prelude+-- >>> import qualified Data.List as List+-- >>> import Data.Ord (comparing) -- | Number of elements in 'NonEmpty' list. length :: NonEmpty a -> Int length (_ :| xs) = 1 + Prelude.length xs +-- | Use 'compareLength' @xs@ @n@ as a safer and faster alternative+-- to 'compare' ('length' @xs@) @n@. Similarly, it's better+-- to write @compareLength xs 10 == LT@ instead of @length xs < 10@.+--+-- While 'length' would force and traverse+-- the entire spine of @xs@ (which could even diverge if @xs@ is infinite),+-- 'compareLength' traverses at most @n@ elements to determine its result.+--+-- >>> compareLength ('a' :| []) 1+-- EQ+-- >>> compareLength ('a' :| ['b']) 3+-- LT+-- >>> compareLength (0 :| [1..]) 100+-- GT+-- >>> compareLength undefined 0+-- GT+-- >>> compareLength ('a' :| 'b' : undefined) 1+-- GT+--+-- @since 4.21.0.0+--+compareLength :: NonEmpty a -> Int -> Ordering+compareLength xs n+ | n < 1 = GT+ | otherwise = foldr+ (\_ f m -> if m > 0 then f (m - 1) else GT)+ (\m -> if m > 0 then LT else EQ)+ xs+ n+ -- | Compute n-ary logic exclusive OR operation on 'NonEmpty' list. xor :: NonEmpty Bool -> Bool xor (x :| xs) = foldr xor' x xs@@ -205,7 +238,7 @@ -- >>> sortOn fst $ (2, "world") :| [(4, "!"), (1, "Hello")] -- (1,"Hello") :| [(2,"world"),(4,"!")] ----- >>> sortOn length $ "jim" :| ["creed", "pam", "michael", "dwight", "kevin"]+-- >>> sortOn List.length ("jim" :| ["creed", "pam", "michael", "dwight", "kevin"]) -- "jim" :| ["pam","creed","kevin","dwight","michael"] -- -- ==== __Performance notes__@@ -271,15 +304,7 @@ -- -- @since 4.18 inits1 :: NonEmpty a -> NonEmpty (NonEmpty a)-inits1 =- -- fromList is an unsafe function, but this usage should be safe, since:- -- * `inits xs = [[], ..., init (init xs), init xs, xs]`- -- * If `xs` is nonempty, it follows that `inits xs` contains at least one nonempty- -- list, since `last (inits xs) = xs`.- -- * The only empty element of `inits xs` is the first one (by the definition of `inits`)- -- * Therefore, if we take all but the first element of `inits xs` i.e.- -- `tail (inits xs)`, we have a nonempty list of nonempty lists- fromList . Prelude.map fromList . List.drop 1 . List.inits . Foldable.toList+inits1 = fromList . List.inits1 . Foldable.toList -- | The 'tails' function takes a stream @xs@ and returns all the -- suffixes of @xs@, starting with the longest. The result is 'NonEmpty'@@ -299,15 +324,7 @@ -- -- @since 4.18 tails1 :: NonEmpty a -> NonEmpty (NonEmpty a)-tails1 =- -- fromList is an unsafe function, but this usage should be safe, since:- -- * `tails xs = [xs, tail xs, tail (tail xs), ..., []]`- -- * If `xs` is nonempty, it follows that `tails xs` contains at least one nonempty- -- list, since `head (tails xs) = xs`.- -- * The only empty element of `tails xs` is the last one (by the definition of `tails`)- -- * Therefore, if we take all but the last element of `tails xs` i.e.- -- `init (tails xs)`, we have a nonempty list of nonempty lists- fromList . Prelude.map fromList . List.init . List.tails . Foldable.toList+tails1 = fromList . List.tails1 . Foldable.toList -- | @'insert' x xs@ inserts @x@ into the last position in @xs@ where it -- is still less than or equal to the next element. In particular, if the@@ -437,7 +454,7 @@ -- For example, in list notation: -- -- >>> group "Mississippi"--- ["M", "i", "ss", "i", "ss", "i", "pp", "i"]+-- ['M' :| "",'i' :| "",'s' :| "s",'i' :| "",'s' :| "s",'i' :| "",'p' :| "p",'i' :| ""] group :: (Foldable f, Eq a) => f a -> [NonEmpty a] group = groupBy (==) @@ -520,16 +537,6 @@ | otherwise = error "NonEmpty.!! negative index" infixl 9 !! --- | The 'zip' function takes two streams and returns a stream of--- corresponding pairs.-zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a,b)-zip ~(x :| xs) ~(y :| ys) = (x, y) :| List.zip xs ys---- | The 'zipWith' function generalizes 'zip'. Rather than tupling--- the elements, the elements are combined using the function--- passed as the first argument.-zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c-zipWith f ~(x :| xs) ~(y :| ys) = f x y :| List.zipWith f xs ys -- | The 'unzip' function is the inverse of the 'zip' function. unzip :: Functor f => f (a,b) -> (f a, f b)
src/Data/Monoid.hs view
@@ -24,6 +24,7 @@ -- -- The 'Sum' monoid is defined by the numerical addition operator and `0` as neutral element: --+-- >>> import Data.Int -- >>> mempty :: Sum Int -- Sum {getSum = 0} -- >>> Sum 1 <> Sum 2 <> Sum 3 <> Sum 4 :: Sum Int@@ -73,3 +74,4 @@ ) where import GHC.Internal.Data.Monoid+
src/Data/Semigroup.hs view
@@ -38,11 +38,15 @@ -- can never be empty: -- -- >>> (1 :| [])--- 1 :| [] -- equivalent to [1] but guaranteed to be non-empty.+-- 1 :| [] --+-- -- equivalent to [1] but guaranteed to be non-empty.+-- -- >>> (1 :| [2, 3, 4])--- 1 :| [2,3,4] -- equivalent to [1,2,3,4] but guaranteed to be non-empty.+-- 1 :| [2,3,4] --+-- -- equivalent to [1,2,3,4] but guaranteed to be non-empty.+-- -- Equipped with this guaranteed to be non-empty data structure, we can combine -- values using 'sconcat' and a 'Semigroup' of our choosing. We can try the 'Min' -- and 'Max' instances of 'Int' which pick the smallest, or largest number@@ -122,6 +126,7 @@ -- $setup -- >>> import Prelude -- >>> import Data.List.NonEmpty (NonEmpty (..))+-- >>> import GHC.Internal.Data.Semigroup.Internal -- | A generalization of 'GHC.Internal.Data.List.cycle' to an arbitrary 'Semigroup'. -- May fail to terminate for some values in some semigroups.@@ -135,7 +140,7 @@ -- Right 1 -- -- >>> cycle1 (Left 1)--- * hangs forever *+-- * Hangs forever * cycle1 :: Semigroup m => m -> m cycle1 xs = xs' where xs' = xs <> xs' @@ -143,7 +148,7 @@ -- -- ==== __Examples__ ----- > let hello = diff "Hello, "+-- >>> let hello = diff "Hello, " -- -- >>> appEndo hello "World!" -- "Hello, World!"@@ -154,8 +159,8 @@ -- >>> appEndo (mempty <> hello) "World!" -- "Hello, World!" ----- > let world = diff "World"--- > let excl = diff "!"+-- >>> let world = diff "World"+-- >>> let excl = diff "!" -- -- >>> appEndo (hello <> (world <> excl)) mempty -- "Hello, World!"@@ -171,7 +176,7 @@ -- ==== __Examples__ -- -- >>> Min 42 <> Min 3--- Min 3+-- Min {getMin = 3} -- -- >>> sconcat $ Min 1 :| [ Min n | n <- [2 .. 100]] -- Min {getMin = 1}@@ -256,7 +261,7 @@ -- ==== __Examples__ -- -- >>> Max 42 <> Max 3--- Max 42+-- Max {getMax = 42} -- -- >>> sconcat $ Max 1 :| [ Max n | n <- [2 .. 100]] -- Max {getMax = 100}@@ -335,7 +340,11 @@ fromInteger = Max . fromInteger -- | 'Arg' isn't itself a 'Semigroup' in its own right, but it can be--- placed inside 'Min' and 'Max' to compute an arg min or arg max.+-- placed inside 'Min' and 'Max' to compute an arg min or arg max. In+-- the event of ties, the leftmost qualifying 'Arg' is chosen; contrast+-- with the behavior of 'minimum' and 'maximum' for many other types,+-- where ties are broken by considering elements to the left in the+-- structure to be less than elements to the right. -- -- ==== __Examples__ --@@ -392,11 +401,25 @@ instance Traversable (Arg a) where traverse f (Arg x a) = Arg x `fmap` f a --- | @since 4.9.0.0+-- |+-- Note that `Arg`'s 'Eq' instance does not satisfy extensionality:+--+-- >>> Arg 0 0 == Arg 0 1+-- True+-- >>> let f (Arg _ x) = x in f (Arg 0 0) == f (Arg 0 1)+-- False+--+-- @since 4.9.0.0 instance Eq a => Eq (Arg a b) where Arg a _ == Arg b _ = a == b --- | @since 4.9.0.0+-- |+-- Note that `Arg`'s 'Ord' instance has 'min' and 'max' implementations that+-- differ from the tie-breaking conventions of the default implementation of+-- 'min' and 'max' in class 'Ord'; 'Arg' breaks ties by favoring the first+-- argument in both functions.+--+-- @since 4.9.0.0 instance Ord a => Ord (Arg a b) where Arg a _ `compare` Arg b _ = compare a b min x@(Arg a _) y@(Arg b _)@@ -428,10 +451,10 @@ -- ==== __Examples__ -- -- >>> First 0 <> First 10--- First 0+-- First {getFirst = 0} -- -- >>> sconcat $ First 1 :| [ First n | n <- [2 ..] ]--- First 1+-- First {getFirst = 1} newtype First a = First { getFirst :: a } deriving ( Bounded -- ^ @since 4.9.0.0 , Eq -- ^ @since 4.9.0.0@@ -502,7 +525,7 @@ -- Last {getLast = 10} -- -- >>> sconcat $ Last 1 :| [ Last n | n <- [2..]]--- Last {getLast = * hangs forever *+-- * Hangs forever * newtype Last a = Last { getLast :: a } deriving ( Bounded -- ^ @since 4.9.0.0 , Eq -- ^ @since 4.9.0.0@@ -629,7 +652,7 @@ -- ==== __Examples__ -- -- >>> mtimesDefault 0 "bark"--- []+-- "" -- -- >>> mtimesDefault 3 "meow" -- "meowmeowmeow"
src/Data/Traversable.hs view
@@ -86,6 +86,13 @@ import GHC.Internal.Data.Traversable +-- $setup+-- >>> import Prelude+-- >>> import Data.Maybe+-- >>> import Data.Either+-- >>> import qualified Data.List as List+-- >>> :set -XExplicitForAll+ -- $overview -- -- #overview#@@ -201,13 +208,13 @@ -- __@a@__), the result of __@mapM g ts@__ will contain multiple structures of -- the same shape as __@ts@__: ----- prop> length (mapM g ts) == product (fmap (length . g) ts)+-- prop> List.length (mapM g ts) == List.product (fmap (List.length . g) ts) -- -- For example: ----- >>> length $ mapM (\n -> [1..n]) [1..6]+-- >>> List.length $ mapM (\n -> [1..n]) [1..6] -- 720--- >>> product $ length . (\n -> [1..n]) <$> [1..6]+-- >>> List.product $ List.length . (\n -> [1..n]) <$> [1..6] -- 720 -- -- In other words, a traversal with a function __@g :: a -> [b]@__, over an@@ -1006,14 +1013,16 @@ -- used to implicitly wrap and unwrap the @ZipList@ @newtype@ as needed, giving -- a function that operates on a list of lists: ----- >>> {-# LANGUAGE ScopedTypeVariables #-}+-- >>> :set -XScopedTypeVariables -- >>> import Control.Applicative (ZipList(..)) -- >>> import Data.Coerce (coerce) -- >>>--- >>> transpose :: forall a. [[a]] -> [[a]]--- >>> transpose = coerce (sequenceA :: [ZipList a] -> ZipList [a])--- >>>--- >>> transpose [[1,2,3],[4..],[7..]]+-- >>> :{+-- >>> let+-- >>> transpose :: forall a. [[a]] -> [[a]]+-- >>> transpose = coerce (sequenceA :: [ZipList a] -> ZipList [a])+-- >>> in transpose [[1,2,3],[4..],[7..]]+-- >>> :} -- [[1,4,7],[2,5,8],[3,6,9]] -- -- The use of [coercion](#coercion) avoids the need to explicitly wrap and
src/GHC/Base.hs view
@@ -47,7 +47,7 @@ , unpackNBytes# -- * Magic combinators- , inline, noinline, lazy, oneShot, runRW#, DataToTag(..)+ , inline, noinline, lazy, oneShot, runRW#, seq#, DataToTag(..) , WithDict(withDict) -- * Functions over 'Bool'@@ -139,15 +139,142 @@ ) where import GHC.Internal.Base-import GHC.Prim hiding (dataToTagLarge#, dataToTagSmall#, whereFrom#)- -- Hide dataToTagLarge# because it is expected to break for- -- GHC-internal reasons in the near future, and shouldn't- -- be exposed from base (not even GHC.Exts)- -- whereFrom# is similarly internal.+import GHC.Prim hiding+ (+ -- Hide dataToTag# ops because they are expected to break for+ -- GHC-internal reasons in the near future, and shouldn't+ -- be exposed from base+ dataToTagSmall#, dataToTagLarge#+ -- whereFrom# is similarly internal.+ , whereFrom#+ , isByteArrayWeaklyPinned#, isMutableByteArrayWeaklyPinned#+ -- Don't re-export vector FMA instructions+ , fmaddFloatX4#+ , fmsubFloatX4#+ , fnmaddFloatX4#+ , fnmsubFloatX4#+ , fmaddFloatX8#+ , fmsubFloatX8#+ , fnmaddFloatX8#+ , fnmsubFloatX8#+ , fmaddFloatX16#+ , fmsubFloatX16#+ , fnmaddFloatX16#+ , fnmsubFloatX16#+ , fmaddDoubleX2#+ , fmsubDoubleX2#+ , fnmaddDoubleX2#+ , fnmsubDoubleX2#+ , fmaddDoubleX4#+ , fmsubDoubleX4#+ , fnmaddDoubleX4#+ , fnmsubDoubleX4#+ , fmaddDoubleX8#+ , fmsubDoubleX8#+ , fnmaddDoubleX8#+ , fnmsubDoubleX8#+ -- Don't re-export SIMD shuffle primops+ , shuffleDoubleX2#+ , shuffleDoubleX4#+ , shuffleDoubleX8#+ , shuffleFloatX16#+ , shuffleFloatX4#+ , shuffleFloatX8#+ , shuffleInt16X16#+ , shuffleInt16X32#+ , shuffleInt16X8#+ , shuffleInt32X16#+ , shuffleInt32X4#+ , shuffleInt32X8#+ , shuffleInt64X2#+ , shuffleInt64X4#+ , shuffleInt64X8#+ , shuffleInt8X16#+ , shuffleInt8X32#+ , shuffleInt8X64#+ , shuffleWord16X16#+ , shuffleWord16X32#+ , shuffleWord16X8#+ , shuffleWord32X16#+ , shuffleWord32X4#+ , shuffleWord32X8#+ , shuffleWord64X2#+ , shuffleWord64X4#+ , shuffleWord64X8#+ , shuffleWord8X16#+ , shuffleWord8X32#+ , shuffleWord8X64#+ -- Don't re-export min/max primops+ , maxDouble#+ , maxDoubleX2#+ , maxDoubleX4#+ , maxDoubleX8#+ , maxFloat#+ , maxFloatX16#+ , maxFloatX4#+ , maxFloatX8#+ , maxInt16X16#+ , maxInt16X32#+ , maxInt16X8#+ , maxInt32X16#+ , maxInt32X4#+ , maxInt32X8#+ , maxInt64X2#+ , maxInt64X4#+ , maxInt64X8#+ , maxInt8X16#+ , maxInt8X32#+ , maxInt8X64#+ , maxWord16X16#+ , maxWord16X32#+ , maxWord16X8#+ , maxWord32X16#+ , maxWord32X4#+ , maxWord32X8#+ , maxWord64X2#+ , maxWord64X4#+ , maxWord64X8#+ , maxWord8X16#+ , maxWord8X32#+ , maxWord8X64#+ , minDouble#+ , minDoubleX2#+ , minDoubleX4#+ , minDoubleX8#+ , minFloat#+ , minFloatX16#+ , minFloatX4#+ , minFloatX8#+ , minInt16X16#+ , minInt16X32#+ , minInt16X8#+ , minInt32X16#+ , minInt32X4#+ , minInt32X8#+ , minInt64X2#+ , minInt64X4#+ , minInt64X8#+ , minInt8X16#+ , minInt8X32#+ , minInt8X64#+ , minWord16X16#+ , minWord16X32#+ , minWord16X8#+ , minWord32X16#+ , minWord32X4#+ , minWord32X8#+ , minWord64X2#+ , minWord64X4#+ , minWord64X8#+ , minWord8X16#+ , minWord8X32#+ , minWord8X64#+ ) import GHC.Prim.Ext import GHC.Prim.PtrEq import GHC.Internal.Err+import GHC.Internal.IO (seq#) import GHC.Internal.Maybe import GHC.Types hiding ( Unit#,
src/GHC/Desugar.hs view
@@ -1,6 +1,8 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE Safe #-} {-# OPTIONS_HADDOCK not-home #-} +----------------------------------------------------------------------------- -- | -- -- Module : GHC.Desugar@@ -8,7 +10,7 @@ -- License : see libraries/base/LICENSE -- -- Maintainer : ghc-devs@haskell.org--- Stability : internal+-- Stability : deprecated (<https://github.com/haskell/core-libraries-committee/issues/216>) -- Portability : non-portable (GHC extensions) -- -- Support code for desugaring in GHC@@ -18,11 +20,14 @@ -- bound, e.g., @base < 4.X@ rather than @base < 5@, because the interface can -- change rapidly without much warning. --+----------------------------------------------------------------------------- +#if __GLASGOW_HASKELL >= 914+#error "GHC.Desugar should be removed in GHC 9.14"+#endif+ module GHC.Desugar- ((>>>),- AnnotationWrapper(..),- toAnnotationWrapper- ) where+ {-# DEPRECATED ["GHC.Desugar is deprecated and will be removed in GHC 9.14.", "(>>>) should be imported from Control.Arrow.", "AnnotationWrapper is internal to GHC and should not be used externally."] #-}+ ((>>>), AnnotationWrapper(..), toAnnotationWrapper) where import GHC.Internal.Desugar
src/GHC/Exception.hs view
@@ -44,7 +44,7 @@ -- * Reexports -- Re-export CallStack and SrcLoc from GHC.Types , CallStack, fromCallSiteList, getCallStack, prettyCallStack- , prettyCallStackLines, showCCSStack+ , prettyCallStackLines , SrcLoc(..), prettySrcLoc ) where
src/GHC/ExecutionStack/Internal.hs view
@@ -16,7 +16,7 @@ -- -- @since 4.9.0.0 -module GHC.ExecutionStack.Internal (+module GHC.ExecutionStack.Internal {-# DEPRECATED "This module will be removed from base in the next version (v4.22)" #-} ( -- * Internal Location (..) , SrcLoc (..)
src/GHC/Exts.hs view
@@ -26,6 +26,12 @@ -- ** Legacy interface for arrays of arrays module GHC.Internal.ArrayArray, -- * Primitive operations+ {-# DEPRECATED ["The BCO, mkApUpd0#, and newBCO# re-exports from GHC.Exts have been deprecated and will be removed in 9.14", "These symbols should be imported from ghc-internal instead if needed."] #-}+ Prim.BCO,+ {-# DEPRECATED ["The BCO, mkApUpd0#, and newBCO# re-exports from GHC.Exts have been deprecated and will be removed in 9.14", "These symbols should be imported from ghc-internal instead if needed."] #-}+ Prim.mkApUpd0#,+ {-# DEPRECATED ["The BCO, mkApUpd0#, and newBCO# re-exports from GHC.Exts have been deprecated and will be removed in 9.14", "These symbols should be imported from ghc-internal instead if needed."] #-}+ Prim.newBCO#, module GHC.Prim, module GHC.Prim.Ext, -- ** Running 'RealWorld' state thread@@ -93,6 +99,7 @@ lazy, oneShot, considerAccessible,+ seq#, -- * SpecConstr annotations SpecConstrAnnotation(..), SPEC(..),@@ -114,11 +121,143 @@ import GHC.Internal.Exts import GHC.Internal.ArrayArray-import GHC.Prim hiding ( coerce, dataToTagSmall#, dataToTagLarge#, whereFrom# )+import GHC.Prim hiding+ ( coerce -- Hide dataToTag# ops because they are expected to break for -- GHC-internal reasons in the near future, and shouldn't -- be exposed from base (not even GHC.Exts)- -- whereFrom# is similarly internal.+ , dataToTagSmall#, dataToTagLarge#+ -- whereFrom# is similarly internal.+ , whereFrom#+ , isByteArrayWeaklyPinned#, isMutableByteArrayWeaklyPinned#++ -- deprecated+ , BCO, mkApUpd0#, newBCO#++ -- Don't re-export vector FMA instructions+ , fmaddFloatX4#+ , fmsubFloatX4#+ , fnmaddFloatX4#+ , fnmsubFloatX4#+ , fmaddFloatX8#+ , fmsubFloatX8#+ , fnmaddFloatX8#+ , fnmsubFloatX8#+ , fmaddFloatX16#+ , fmsubFloatX16#+ , fnmaddFloatX16#+ , fnmsubFloatX16#+ , fmaddDoubleX2#+ , fmsubDoubleX2#+ , fnmaddDoubleX2#+ , fnmsubDoubleX2#+ , fmaddDoubleX4#+ , fmsubDoubleX4#+ , fnmaddDoubleX4#+ , fnmsubDoubleX4#+ , fmaddDoubleX8#+ , fmsubDoubleX8#+ , fnmaddDoubleX8#+ , fnmsubDoubleX8#+ -- Don't re-export SIMD shuffle primops+ , shuffleDoubleX2#+ , shuffleDoubleX4#+ , shuffleDoubleX8#+ , shuffleFloatX16#+ , shuffleFloatX4#+ , shuffleFloatX8#+ , shuffleInt16X16#+ , shuffleInt16X32#+ , shuffleInt16X8#+ , shuffleInt32X16#+ , shuffleInt32X4#+ , shuffleInt32X8#+ , shuffleInt64X2#+ , shuffleInt64X4#+ , shuffleInt64X8#+ , shuffleInt8X16#+ , shuffleInt8X32#+ , shuffleInt8X64#+ , shuffleWord16X16#+ , shuffleWord16X32#+ , shuffleWord16X8#+ , shuffleWord32X16#+ , shuffleWord32X4#+ , shuffleWord32X8#+ , shuffleWord64X2#+ , shuffleWord64X4#+ , shuffleWord64X8#+ , shuffleWord8X16#+ , shuffleWord8X32#+ , shuffleWord8X64#+ -- Don't re-export min/max primops+ , maxDouble#+ , maxDoubleX2#+ , maxDoubleX4#+ , maxDoubleX8#+ , maxFloat#+ , maxFloatX16#+ , maxFloatX4#+ , maxFloatX8#+ , maxInt16X16#+ , maxInt16X32#+ , maxInt16X8#+ , maxInt32X16#+ , maxInt32X4#+ , maxInt32X8#+ , maxInt64X2#+ , maxInt64X4#+ , maxInt64X8#+ , maxInt8X16#+ , maxInt8X32#+ , maxInt8X64#+ , maxWord16X16#+ , maxWord16X32#+ , maxWord16X8#+ , maxWord32X16#+ , maxWord32X4#+ , maxWord32X8#+ , maxWord64X2#+ , maxWord64X4#+ , maxWord64X8#+ , maxWord8X16#+ , maxWord8X32#+ , maxWord8X64#+ , minDouble#+ , minDoubleX2#+ , minDoubleX4#+ , minDoubleX8#+ , minFloat#+ , minFloatX16#+ , minFloatX4#+ , minFloatX8#+ , minInt16X16#+ , minInt16X32#+ , minInt16X8#+ , minInt32X16#+ , minInt32X4#+ , minInt32X8#+ , minInt64X2#+ , minInt64X4#+ , minInt64X8#+ , minInt8X16#+ , minInt8X32#+ , minInt8X64#+ , minWord16X16#+ , minWord16X32#+ , minWord16X8#+ , minWord32X16#+ , minWord32X4#+ , minWord32X8#+ , minWord64X2#+ , minWord64X4#+ , minWord64X8#+ , minWord8X16#+ , minWord8X32#+ , minWord8X64#+ )+import qualified GHC.Prim as Prim+ ( BCO, mkApUpd0#, newBCO# ) import GHC.Prim.Ext
src/GHC/IO/Encoding/Iconv.hs view
@@ -27,5 +27,4 @@ #else ( ) where -import Prelude () -- for build ordering (#23942) #endif
src/GHC/IO/Handle.hs view
src/GHC/IO/StdHandles.hs view
− src/GHC/Pack.hs
@@ -1,37 +0,0 @@-{-# LANGUAGE MagicHash #-}-{-# OPTIONS_HADDOCK not-home #-}---- |------ Module : GHC.Pack--- Copyright : (c) The University of Glasgow 1997-2002--- License : see libraries/base/LICENSE------ Maintainer : ghc-devs@haskell.org--- Stability : internal--- Portability : non-portable (GHC Extensions)------ ⚠ Warning: Starting @base-4.18@, this module is being deprecated.--- See https://gitlab.haskell.org/ghc/ghc/-/issues/21461 for more information.------------ This module provides a small set of low-level functions for packing--- and unpacking a chunk of bytes. Used by code emitted by the compiler--- plus the prelude libraries.------ The programmer level view of packed strings is provided by a GHC--- system library PackedString.-----module GHC.Pack- {-# DEPRECATED "The exports of this module should be instead imported from GHC.Exts" #-}- (packCString#,- unpackCString,- unpackCString#,- unpackNBytes#,- unpackFoldrCString#,- unpackAppendCString#- ) where--import GHC.Internal.Pack
src/GHC/RTS/Flags.hs view
@@ -25,6 +25,7 @@ , GCFlags (..) , ConcFlags (..) , MiscFlags (..)+ , IoManagerFlag (..) , DebugFlags (..) , DoCostCentres (..) , CCFlags (..)@@ -35,12 +36,12 @@ , TickyFlags (..) , ParFlags (..) , HpcFlags (..)- , IoSubSystem (..)+ , {-# DEPRECATED "import GHC.IO.SubSystem (IoSubSystem (..))" #-}+ IoSubSystem (..) , getRTSFlags , getGCFlags , getConcFlags , getMiscFlags- , getIoManagerFlag , getDebugFlags , getCCFlags , getProfFlags@@ -51,3 +52,4 @@ ) where import GHC.Internal.RTS.Flags+import GHC.Internal.IO.SubSystem (IoSubSystem(..))
src/GHC/TypeLits/Internal.hs view
@@ -26,7 +26,7 @@ -- -- @since 4.16.0.0 -module GHC.TypeLits.Internal+module GHC.TypeLits.Internal {-# DEPRECATED "This module will be removed from base in the next version (v4.22)" #-} (Symbol, CmpSymbol, CmpChar
src/GHC/TypeNats/Internal.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE Safe #-} {-# OPTIONS_HADDOCK not-home #-} -module GHC.TypeNats.Internal+module GHC.TypeNats.Internal {-# DEPRECATED "This module will be removed from base in the next version (v4.22)" #-} (Natural, CmpNat ) where
src/System/IO.hs view
@@ -14,7 +14,10 @@ -- module System.IO- (-- * The IO monad+ (-- * Examples+ -- $stdio_examples++ -- * The IO monad IO, fixIO, -- * Files and handles@@ -199,3 +202,18 @@ -- It follows that an attempt to write to a file (using 'writeFile', for -- example) that was earlier opened by 'readFile' will usually result in -- failure with 'GHC.Internal.System.IO.Error.isAlreadyInUseError'.++-- $stdio_examples+-- Note: Some of the examples in this module do not work "as is" in ghci.+-- This is because using 'stdin' in combination with lazy IO+-- does not work well in interactive mode.+--+-- Lines starting with @>@ indicate 'stdin' and @^D@ signales EOF.+--+-- ==== __Example__+--+-- ghci> foo+-- > input+-- output+-- > input^D+-- output