You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A compilable example would save beginners' time. For example:
> composed = cos >> sin
<function> : Float -> Float
> composed pi
-0.8414709848078965 : Float
> sin (cos pi)
-0.8414709848078965 : Float
> sin (cos pi) == composed pi
True : Bool
I believe it's an error:
>import Arithmetic
> sqrt
<function> : Float -> Float
> Arithmetic.isEven
<function> : Int -> Bool
> not
<function> : Bool -> Bool
> sqrt >> Arithmetic.isEven >> not
-- TYPE MISMATCH ---------------------------------------------------------- REPL
The right argument of (>>) is causing problems.
4| sqrt >> Arithmetic.isEven >> not
^^^^^^^^^^^^^^^^^^^^^^^^
The right argument is:
Int -> Bool
But (>>) needs the right argument to be:
Float -> c
Hint: With operators like (>>) I always check the left side first. If it seems
fine, I assume it is correct and check the right side. So the problem may be in
how the left and right arguments interact!
Note: Read <https://elm-lang.org/0.19.1/implicit-casts> to learn why Elm does
not implicitly convert Ints to Floats. Use toFloat and round to do explicit
conversions.
This shows up in a comment and in the docs.
A compilable example would save beginners' time. For example:
I believe it's an error:
Here's a correction:
The text was updated successfully, but these errors were encountered: