Illegal role name. [GHC-09009]

Language extension: RoleAnnotations

With the RoleAnnotations extension, type role annotations can be added to type or class declarations. These must be one of representational, nominal, or phantom.

Examples

Type roles should be one of representational, nominal, or phantom.

Type role annotations should be one of representational, nominal, or phantom. Fortunately as the choices are limited, GHC is smart enough to suggest which role you intended if a mistake is made.

Error Message

IllegalRole.hs:5:13: error:
    Illegal role name ‘pantom’
    Perhaps you meant ‘phantom’
  |
5 | type role A pantom
  |             ^^^^^^
IllegalRole.hs
Before
{-# LANGUAGE RoleAnnotations #-}

module IllegalRole where

type role A pantom
data A a = A
After
{-# LANGUAGE RoleAnnotations #-}

module IllegalRole where

type role A phantom
data A a = A