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
> [-8] < 0
-- TYPE MISMATCH --------------------------------------------- repl-temp-000.elm
The right side of (<) is causing a type mismatch.
3| [-8] < 0
^
(<) is expecting the right side to be a:
List number
But the right side is:
number
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.
JavaScript (YOU KNEW WHAT THIS WAS GOING TO DO RIGHT?)
> [-8] < 0
true
Swift
1> [-8] < 0
error: repl.swift:1:6: error: binary operator '<' cannot be applied to operands of type '[Int]' and 'Int'
Standard ML
- [~8] < 0;
! Toplevel input:
! [~8] < 0;
! ^
! Type clash: expression of type
! int
! cannot have type
! int list
Erlang
1> [-8] < 0.
false
Scala
scala> List(-8) < 0
<console>:12: error: value < is not a member of List[Int]
CoffeeScript (Well it is just JavaScript)
coffee> [-8] < 0
Expression assignment to _ now disabled.
true
Haskell
Prelude> [-8] < 0
<interactive>:13:1: error:
• Ambiguous type variable ‘t0’ arising from a use of ‘<’
prevents the constraint ‘(Ord t0)’ from being solved.
Probable fix: use a type annotation to specify what ‘t0’ should be.
These potential instances exist:
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord Integer
-- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’
instance Ord a => Ord (Maybe a) -- Defined in ‘GHC.Base’
...plus 22 others
...plus five instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: [- 8] < 0
In an equation for ‘it’: it = [- 8] < 0
<interactive>:13:2: error:
• Ambiguous type variable ‘t0’ arising from a use of syntactic negation
prevents the constraint ‘(Num t0)’ from being solved.
Probable fix: use a type annotation to specify what ‘t0’ should be.
These potential instances exist:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
...plus two others
(use -fprint-potential-instances to see them all)
• In the expression: - 8
In the first argument of ‘(<)’, namely ‘[- 8]’
In the expression: [- 8] < 0
<interactive>:13:8: error:
• No instance for (Num [t0]) arising from the literal ‘0’
• In the second argument of ‘(<)’, namely ‘0’
In the expression: [- 8] < 0
In an equation for ‘it’: it = [- 8] < 0
Idris
Idris> [-8] < 0
List Integer is not a numeric type