Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions message-index/messages/GHC-83475/example1/after/Example1.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# OPTIONS_GHC -fwarn-unused-record-wildcards #-}
{-# LANGUAGE RecordWildCards #-}
module Example1 where

data Foo = Foo { x :: Int, y :: Int, name :: String }

f :: Foo -> String
f Foo{} = "Hello"
8 changes: 8 additions & 0 deletions message-index/messages/GHC-83475/example1/before/Example1.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# OPTIONS_GHC -fwarn-unused-record-wildcards #-}
{-# LANGUAGE RecordWildCards #-}
module Example1 where

data Foo = Foo { x :: Int, y :: Int, name :: String }

f :: Foo -> String
f Foo{..} = "Hello"
16 changes: 16 additions & 0 deletions message-index/messages/GHC-83475/example1/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Pattern contains unused record wildcard
---

None of the fields bound by `Foo{..}` are used in `f`, so the pattern may be safely removed.

## Warning

```
GHC-83475/example1/before/Example1.hs:7:7: warning: [-Wunused-record-wildcards]
No variables bound in the record wildcard match are used
Possible fix: omit the ‘..’
|
7 | f Foo{..} = "Hello"
| ^^
```
9 changes: 9 additions & 0 deletions message-index/messages/GHC-83475/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Unused Record Wildcard
summary: Pattern contains record wildcard that is not used
severity: warning
flag: -Wunused-record-wildcards
introduced: 9.6.1
---

If `RecordWildCards` is enabled we can automatically bind fields of a record by using patterns like `MyRecord{..}`. Not using any of the record fields that were bound using the record wildcard syntax will result in a warning.
Loading