base 4.17.2.0 → 4.17.2.1
raw patch · 5 files changed
+81/−6 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/String.hs +20/−2
- GHC/Base.hs +35/−3
- GHC/Float.hs +19/−0
- base.cabal +1/−1
- changelog.md +6/−0
Data/String.hs view
@@ -37,8 +37,26 @@ import Data.Functor.Identity (Identity (Identity)) import Data.List (lines, words, unlines, unwords) --- | Class for string-like datastructures; used by the overloaded string--- extension (-XOverloadedStrings in GHC).+-- | `IsString` is used in combination with the @-XOverloadedStrings@+-- language extension to convert the literals to different string types.+--+-- For example, if you use the [text](https://hackage.haskell.org/package/text) package,+-- you can say+--+-- @+-- {-# LANGUAGE OverloadedStrings #-}+--+-- myText = "hello world" :: Text+-- @+--+-- Internally, the extension will convert this to the equivalent of+--+-- @+-- myText = fromString @Text ("hello world" :: String)+-- @+--+-- __Note:__ You can use @fromString@ in normal code as well,+-- but the usual performance/memory efficiency problems with 'String' apply. class IsString a where fromString :: String -> a
GHC/Base.hs view
@@ -1411,10 +1411,42 @@ -- Type Char and String ---------------------------------------------- --- | A 'String' is a list of characters. String constants in Haskell are values--- of type 'String'.+-- | 'String' is an alias for a list of characters. ----- See "Data.List" for operations on lists.+-- String constants in Haskell are values of type 'String'.+-- That means if you write a string literal like @"hello world"@,+-- it will have the type @[Char]@, which is the same as @String@.+--+-- __Note:__ You can ask the compiler to automatically infer different types+-- with the @-XOverloadedStrings@ language extension, for example+-- @"hello world" :: Text@. See t'Data.String.IsString' for more information.+--+-- Because @String@ is just a list of characters, you can use normal list functions+-- to do basic string manipulation. See "Data.List" for operations on lists.+--+-- === __Performance considerations__+--+-- @[Char]@ is a relatively memory-inefficient type.+-- It is a linked list of boxed word-size characters, internally it looks something like:+--+-- > ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭────╮+-- > │ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ [] │+-- > ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰────╯+-- > v v v+-- > 'a' 'b' 'c'+--+-- The @String@ "abc" will use @5*3+1 = 16@ (in general @5n+1@)+-- words of space in memory.+--+-- Furthermore, operations like '(++)' (string concatenation) are @O(n)@+-- (in the left argument).+--+-- For historical reasons, the @base@ library uses @String@ in a lot of places+-- for the conceptual simplicity, but library code dealing with user-data+-- should use the [text](https://hackage.haskell.org/package/text)+-- package for Unicode text, or the the+-- [bytestring](https://hackage.haskell.org/package/bytestring) package+-- for binary data. type String = [Char] unsafeChr :: Int -> Char
GHC/Float.hs view
@@ -1613,3 +1613,22 @@ "Word# -> Natural -> Double#" forall x. naturalToDouble# (NS x) = word2Double# x #-}++-- We don't have word64ToFloat/word64ToDouble primops (#23908), only+-- word2Float/word2Double, so we can only perform these transformations when+-- word-size is 64-bit.+#if WORD_SIZE_IN_BITS == 64+{-# RULES++"Int64# -> Integer -> Float#"+ forall x. integerToFloat# (integerFromInt64# x) = int2Float# (int64ToInt# x)++"Int64# -> Integer -> Double#"+ forall x. integerToDouble# (integerFromInt64# x) = int2Double# (int64ToInt# x)++"Word64# -> Integer -> Float#"+ forall x. integerToFloat# (integerFromWord64# x) = word2Float# (word64ToWord# x)++"Word64# -> Integer -> Double#"+ forall x. integerToDouble# (integerFromWord64# x) = word2Double# (word64ToWord# x) #-}+#endif
base.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: base-version: 4.17.2.0+version: 4.17.2.1 -- NOTE: Don't forget to update ./changelog.md license: BSD-3-Clause
changelog.md view
@@ -1,5 +1,11 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) +## 4.17.2.1 *November 2023*++ * Add missing int64/word64-to-double/float rules ([CLC Proposal #203](https://github.com/haskell/core-libraries-committee/issues/203))++ * Improve String & IsString documentation.+ ## 4.17.2.0 *August 2023* * Restore `mingwex` dependency on Windows (#23309).