Type defaulting does not work when Data contexts are involved
Consider the following Curry example:
last (_ ++ [x]) = x
value = last [1, 2, 3]
PAKCS 2.2.0 (which does not support the Data
typeclass) infers the following types:
last :: [a] -> a
value :: Num a => a
When the user loads the program and evaluates value
in the REPL, its type gets (correctly) defaulted to Int
:
> value
3
In PAKCS 3.2.0 (the current master
branch), the following types are inferred:
last :: Data a => [a] -> a
value :: (Data a, Num a) => a
Evaluating value
in the REPL now fails with an error:
> value
Cannot handle arbitrary overloaded top-level expressions
Hint: add type annotation to overloaded entity