Skip to content

message index: implement GHC-16437 #504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 16, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}

module Deriving_gadt where

data T a b where
Mk :: Int -> b -> T Int b

deriving instance Functor (T a)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Deriving_gadt where

data T a b where
Mk :: Int -> b -> T Int b
deriving (Functor)
3 changes: 3 additions & 0 deletions message-index/messages/GHC-16437/deriving_gadt/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Attempt at using deriving clause with GADT.
---
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Higher_rank where

-- unfortunately we just need a rank 1 type
data Bad a = MkBad a deriving Eq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{-# LANGUAGE RankNTypes #-}

module Higher_rank where

data Bad = MkBad (forall a. a) deriving Eq
3 changes: 3 additions & 0 deletions message-index/messages/GHC-16437/higher_rank/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Use of higher-rank types with a deriving clause.
---
13 changes: 13 additions & 0 deletions message-index/messages/GHC-16437/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Bad Constructor used with deriving clause
summary: Standard deriving fails on GADTs and higher-rank types
severity: error
introduced: 9.6.1
---

The deriving mechanism expects constructors of a particular form. When the constructors do not comport to this form, this error is thrown:

• Can't make a derived instance of ‘Functor (T a)’:
Constructor ‘Mk’ is a GADT
• In the data declaration for ‘T’
Suggested fix: Use a standalone deriving declaration instead