Skip to content

Commit

Permalink
Document GHC-12003
Browse files Browse the repository at this point in the history
Fixes #231.
  • Loading branch information
david-christiansen committed Jun 14, 2022
1 parent 580cb0f commit 5cbd2ab
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions message-index/messages/GHC-12003/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Type equality not in scope
summary: The type equality operator has not been imported into the current module
severity: warning
flag: "-Wcompat"
introduced: 9.6.1
---

In prior versions of GHC, the type equality operator `~` was built-in syntax. In more recent versions, it is an ordinary operator that is part of the `Prelude` and of `Data.Type.Equality`. Restricting imports from `Prelude` can result in `~` not being imported. For now, GHC has a compatibility warning to help migrate old code. In a future version of GHC, this warning will be an error.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# LANGUAGE ExplicitNamespaces #-}
{-# OPTIONS -Wcompat #-}
module TypeEqNotImported where

import Prelude (id, type (~))

f :: (a ~ b) => a -> b
f = id
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

{-# OPTIONS -Wcompat #-}
module TypeEqNotImported where

import Prelude (id)

f :: (a ~ b) => a -> b
f = id
5 changes: 5 additions & 0 deletions message-index/messages/GHC-12003/out-of-scope/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Type equality not imported from Prelude
---

In this example, the type equality operator was not imported from the `Prelude`. To remove the warning, it must be imported.

0 comments on commit 5cbd2ab

Please sign in to comment.