Skip to content

Commit 76bd253

Browse files
committed
core: Fix doc string of integerValue
1 parent 484beb8 commit 76bd253

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

unicode-data/lib/Unicode/Char/Numeric.hs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,16 @@ numericValue = V.numericValue
9696
-- This is a special case of 'numericValue'.
9797
--
9898
-- __Warning:__ There is a risk of /integer overflow/ depending of the chosen
99-
-- concrete return type. As of Unicode 15.0 the results range from 0 to 1e12.
100-
--
101-
-- >>> integerValue '\x5146' :: Maybe Int64 -- OK
102-
-- Just 1000000000000
103-
-- >>> integerValue '\x5146' :: Maybe Int32 -- Will overflow!
104-
-- Just (-727379968)
99+
-- concrete return type. As of Unicode 15.1 the results range from 0 to 1e16.
100+
--
101+
-- >>> minimum [v | v@Just{} <- integerValue <$> [minBound..]] :: Maybe Integer
102+
-- Just 0
103+
-- >>> maximum (integerValue <$> [minBound..]) :: Maybe Integer
104+
-- Just 10000000000000000
105+
-- >>> integerValue '\x4EAC' :: Maybe Int64 -- OK
106+
-- Just 10000000000000000
107+
-- >>> integerValue '\x4EAC' :: Maybe Int32 -- Will overflow!
108+
-- Just 1874919424
105109
--
106110
-- Therefore it is advised to use: @'integerValue' \@'Int64'@.
107111
--

0 commit comments

Comments
 (0)