Custom Functor instance: Expected kind ‘* -> *’, but ‘AST’ has kind ‘*’

Viewed 4011

I have this rather simple ADT:

data AST = Node String [AST]
     | Leaf String
     | Empty
    deriving (Show)

and this Functor instance:

instance Functor AST where
    fmap f (Node s l) = Node (f s) (fmap f l)
    fmap f (Leaf s)   = Leaf (f s)
    fmap f Empty      = Empty

But when I try to compile it I get this error that I absolutely not understand:

Expected kind ‘* -> *’, but ‘AST’ has kind ‘*’
   • In the first argument of ‘Functor’, namely ‘AST’
     In the instance declaration for ‘Functor AST’

Does anyone know why this happens? I can't find a solution in the Internet.

2 Answers
Related