I'm having trouble understanding what exactly a comparable
is in Elm. Elm seems as confused as I am.
On the REPL:
> f1 = (<)
<function> : comparable -> comparable -> Bool
So f1
accepts comparables.
> "a"
"a" : String
> f1 "a" "b"
True : Bool
So it seems String
is comparable.
> f2 = (<) 1
<function> : comparable -> Bool
So f2
accepts a comparable.
> f2 "a"
As I infer the type of values flowing through your program, I see a conflict
between these two types:
comparable
String
So String
is and is not comparable?
Why is the type of f2
not number -> Bool
? What other comparables can f2
accept?