Skip to content

Commit

Permalink
fix: s/substract/subtract/g
Browse files Browse the repository at this point in the history
  • Loading branch information
brekk committed May 6, 2024
1 parent ef68635 commit 55a2d8f
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 172 deletions.
2 changes: 1 addition & 1 deletion compiler/test/Infer/SolveSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ spec = do
snapshotTest "should infer assignments" actual

it "should infer minus operator" $ do
let code = "substract = (b, c) => (b - c)"
let code = "subtract = (b, c) => (b - c)"
actual = unsafePerformIO $ inferModuleWithoutMain code
snapshotTest "should infer minus operator" actual

Expand Down
4 changes: 2 additions & 2 deletions prelude/__internal__/ByteArray.mad
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export push = extern "madlib__bytearray__pushBackWithMutation"
*
* @since 0.11.0
* @example
* mapBytes(substract(10), fromString("pqr"))
* mapBytes(subtract(10), fromString("pqr"))
*/
mapBytes :: (Byte -> Byte) -> ByteArray -> ByteArray
export mapBytes = extern "madlib__bytearray__map"
Expand Down Expand Up @@ -357,7 +357,7 @@ export push = (byte, byteArray) => #- {
*
* @since 0.11.0
* @example
* mapBytes(substract(10), fromString("pqr"))
* mapBytes(subtract(10), fromString("pqr"))
*/
mapBytes :: (Byte -> Byte) -> ByteArray -> ByteArray
export mapBytes = (f, byteArray) => #- { return byteArray.map(f) } -#
Expand Down
14 changes: 4 additions & 10 deletions prelude/__internal__/Math.mad
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export add = (a, b) => (a + b)
*
* @since 0.0.5
*/
substract :: Number a => a -> a -> a
export substract = (a, b) => (a - b)
subtract :: Number a => a -> a -> a
export subtract = (a, b) => (a - b)

/**
* Return the product of two numbers
Expand Down Expand Up @@ -114,21 +114,15 @@ export square = (n) => n * n
* @since 0.12.0
*/
min :: Comparable a => a -> a -> a
export min = (a, b) =>
a > b
? b
: a
export min = (a, b) => a > b ? b : a


/**
* Returns the biggest number from the two given
* @since 0.12.0
*/
max :: Comparable a => a -> a -> a
export max = (a, b) =>
a > b
? a
: b
export max = (a, b) => a > b ? a : b


abs :: (Number a, Comparable a) => a -> a
Expand Down
4 changes: 2 additions & 2 deletions prelude/__internal__/Math.spec.mad
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Math from "./Math"

test("add", () => assertEquals(Math.add(4, 3), 7))

test("substract", () => assertEquals(Math.substract(4, 3), 1))
test("subtract", () => assertEquals(Math.subtract(4, 3), 1))

test("multiply", () => assertEquals(Math.multiply(4, 3), 12))

Expand All @@ -33,4 +33,4 @@ test("max", () => assertEquals(Math.max(-17, -1.5), -1.5))
test("atan", () => assertEquals(Math.atan(2.0), 1.10714871779409063102))
#elseif js
test("atan", () => assertEquals(Math.atan(2.0), 1.1071487177940904))
#endif
#endif
Loading

0 comments on commit 55a2d8f

Please sign in to comment.