Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/main/Explain/Format.hs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ createSimpleErrorDiagnostic color _ typeError = case typeError of
NoInstanceFound cls ts ->
"Instance not found\n\n"
<> "No instance for '" <> lst (predToStr True (mempty, mempty) (IsIn cls ts Nothing)) <> "' was found.\n\n"
<> "Hint: Verify that you imported the module where the " <> cls <> "\ninstance for '" <> unwords (prettyPrintType True <$> ts) <> "' is defined"
<> "Hint: Verify that you imported the module where the " <> cls <> "\ninstance for '" <> unwords (prettyPrintType True <$> ts) <> "' is defined\n"
<> "Note: Remember that instance methods are automatically imported when the module\nis imported, directly, or indirectly."

AmbiguousType (TV _ _, IsIn cls _ _ : _) ->
Expand Down
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