3 ms·
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, s
by TylerE 13y ago
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"
- boothead 13y agoSome 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 :-)
- kenko 13y agoThe 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'
- FreeFull 13y agoThe reason behind that error message is how generic numbers are in Haskell by default. 1 + "1" will actually be working code if you make an instance for Num [Char].