Skip to content

Commit a720446

Browse files
committed
Remove squareRoot and absoluteValue from the codeworld-base Prelude.
The standard names have always been `sqrt` and `abs`. Given work on issue #1380, we prefer to use an autocomplete redirect rather than add redundant names in the API. The ultimate motivation was that having `squareRoot` in the API doesn't work so well with other redirects, such as `square` -> `rectangle`, because `squa` autocompletes to `squareRoot` under the direct-hit rule. By moving `squareRoot` to another redirect instead of a full symbol, it gets demoted so it can coexist with the redirect for `square`. I have skipped the usual deprecation cycle, because I checked, and there are no working programs using these functions written this year. That's a low enough volume that I think the risk would be higher that someone starts using them during the deprecation. @Powell-v2 FYI
1 parent 5c46fb1 commit a720446

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

codeworld-available-pkgs/codeworld-available-pkgs.cabal

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Library
2121
NumInstances,
2222
Only,
2323
QuickCheck,
24+
SHA,
2425
StateVar,
2526
Yampa,
2627
active,
@@ -54,6 +55,7 @@ Library
5455
bool8,
5556
bytes,
5657
bytestring,
58+
bytestring-builder,
5759
call-stack,
5860
capability,
5961
case-insensitive,
@@ -240,6 +242,7 @@ Library
240242
random,
241243
random-shuffle,
242244
reactive-banana,
245+
-- reanimate, (depends on chiphunk, which depends on native library)
243246
reducers,
244247
ref-tf,
245248
reflection,

codeworld-base/src/Internal/Num.hs

-8
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ module Internal.Num
3434
min,
3535
negate,
3636
abs,
37-
absoluteValue,
3837
signum,
3938
truncation,
4039
rounded,
@@ -45,7 +44,6 @@ module Internal.Num
4544
pi,
4645
exp,
4746
sqrt,
48-
squareRoot,
4947
log,
5048
logBase,
5149
sin,
@@ -235,9 +233,6 @@ negate = P.negate
235233
abs :: Number -> Number
236234
abs = fromDouble . P.abs . toDouble
237235

238-
absoluteValue :: Number -> Number
239-
absoluteValue = abs
240-
241236
-- | Gives the sign of a number.
242237
--
243238
-- If the number is negative, the signum is -1. If it's positive, the signum
@@ -316,9 +311,6 @@ sqrt (Number x)
316311
withFrozenCallStack (P.error "Negative numbers have no square root.")
317312
| otherwise = fromDouble (P.sqrt x)
318313

319-
squareRoot :: HasCallStack => Number -> Number
320-
squareRoot = sqrt
321-
322314
-- | Gives the natural log of a number. This is the opposite of the exp
323315
-- function.
324316
--

0 commit comments

Comments
 (0)