Re:First look at Clojure.core.typed
by TylerE on Thursday August 29, 2013 @11:16AM
(#6296258)
Admittedly, I'm only a novice at clojure (working on it), but I find that type error really unfriendly. It doesn't provide any clearly actionable information, something like "+ expects it's 2nd argument to be Integer, but internal-number is a Number"
[ Parent
| on HN ]
Some terminology might help..
The domain is the inputs of a function and the range is the output. I assume that if there were multiple arguments to the function it would git you the other ones too.
BTW compare it to the haskell version of the same:
> 1 + "1"
No instance for (GHC.Num.Num [GHC.Types.Char])
arising from a use of `GHC.Num.+'
Possible fix:
add an instance declaration for (GHC.Num.Num [GHC.Types.Char])
The shirt looks significantly less hairy in clojure :-)The Haskell error is made more complicated by the fact that Num is a typeclass that other types can participate in. Other type errors are more tractable:
Prelude> 'a' : 'a'
<interactive>:3:7:
Couldn't match expected type `[Char]' with actual type `Char'
In the second argument of `(:)', namely 'a'
In the expression: 'a' : 'a'
In an equation for `it': it = 'a' : 'a'