data Pol = P [(Int, Int)]
In this declaration, Pol is the type constructor, and P is the only data constructor for this data type. In general, a data type can have several data constructors, so we have this difference.
A simple rule is that you should use a type constructor whenever you are talking about types, and a data constructor whenever you are talking about values.
In this case, you should use Pol in the head of the instance, but P in the templates for your functions.
instance Ord Pol where (P a) > (P b) = ... (P a) < (P b) = ...
Also note that type constructors and data constructors live in different namespaces and are never used in the same context. This means that they have the same name.
data Pol = Pol [(Int, Int)]
This will also work.
source share