Use of "forall" as an identifier [GHC-64088]

Flag: -Wforall-identifier
Enabled by default

The string “forall” is not a keyword in the Haskell 2010 standard. It is therefore possible to declare a top-level function in Haskell 2010 which uses forall as a name. As a result of the accepted GHC proposal 281 the string "forall" will become a reserved keyword in a future version of GHC, so GHC warns against the use of forall as an identifier.


The identifier "forall" should not be used

In this example the programmer implemented a function which checks whether all elements of a list satisfy a given predicate. The programmer has chosen the sensible name “forall” for this function, but this name will become a reserved keyword in a future version of GHC. The function should therefore be renamed, for example to the name “forAll”.

ForallIdentifier.hs:4:1: warning: [GHC-64088] [-Wforall-identifier]
    The use of ‘forall’ as an identifier
    will become an error in a future GHC release.
    Suggested fix:
      Consider using another name, such as
      ‘forAll’, ‘for_all’, or ‘forall_’.
4 | forall f ls = and (fmap f ls)
  | ^^^^^^
module ForallIdentifier where

forall :: (a -> Bool) -> [a] -> Bool
forall f ls = and (map f ls)
module ForallIdentifier where

forAll :: (a -> Bool) -> [a] -> Bool
forAll f ls = and (fmap f ls)