RankNTypes with type aliases confusion [duplicate]
This question already has an answer here: Understanding a rank 2 type alias with a class constraint 2 answers I'm trying to understand how type constraints work with type aliases. First, let's assume I have next type alias: type NumList a = Num a => [a] And I have next function: addFirst :: a -> NumList a -> NumList addFirst x (y:_) = x + y This function fails with next error: Type.hs:9:13: error: • No instance for (Num a) arising from a pattern Possible fix: add (Num a) to the context of the type signature for: addFirst :: a -> NumList a -> a • In the pattern: y : _ In an equation for