его ищет, зачем его вообще искать?
> So, what would a nicer error message look like? I prefer something like this:
Main.hs:3:11: error:
• An instance 'Num a' is required by the use of '+', but no instance was found.
'(+)' has type '(Num a) => a -> a -> a', but its operands were not required to have the '(Num a)' constraint.
Possible fix:
add (Num a) to the constraints of
the type signature for foo:
foo :: a -> a -> a
foo :: (Num a) => a -> a -> a
• In the expression: a + b
In an equation for ‘foo’: foo a b = a + b
|
3 | foo a b = a + b
| ^^^^^
чтобы складывать значения нужен type class Num, его нет, он предлагает добавить констрейнт
Обсуждают сегодня