Unticked promoted constructors [GHC-49957]

Flag: -Wunticked-promoted-constructors
Enabled by:

Language extension: DataKinds

When using a datatype as a kind, its constructors become types. Because Haskell has separate namespaces for data constructors and type constructors, this can lead to ambiguities. These ambiguities can be resolved by prefixing the constructor’s name with a tick mark ('). To avoid potential ambiguities in the future, the flag -Wunticked-promoted-constructors can require that all promoted constructors have tick marks.

Examples

Unticked promoted constructor

Warning

Unticked.hs:5:10: warning: [-Wunticked-promoted-constructors] [GHC-49957]
    Unticked promoted constructor: True.
    Suggested fix: Use 'True instead of True.
  |
5 | type A = True
  |          ^^^^

Explanation

True is a data constructor for type Bool. Here, it is used in a type synonym, which implicitly promotes it to a type constructor of kind Bool. The warning can be resolved by adding the tick mark.

Unticked.hs
Before
{-# LANGUAGE DataKinds #-}
{-# OPTIONS_GHC -Wunticked-promoted-constructors #-}
module Unticked where

type A = True
After
{-# LANGUAGE DataKinds #-}
{-# OPTIONS_GHC -Wunticked-promoted-constructors #-}
module Unticked where

type A = 'True