Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,251
    • Issues 4,251
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 394
    • Merge Requests 394
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9563

Closed
Open
Opened Sep 07, 2014 by mnislaih@trac-mnislaih

Support for deriving Generic1 for data families

The following code:

import GHC.Generics

data family F typ :: * -> *
data A
data instance F A a = AData a deriving Generic1

produces an error when run with ghc 7.8.2 or 7.8.3:

Couldn't match type ‘Rep1 (F A)’
              with ‘M1 t0 t1 (M1 t2 t3 (M1 t4 t5 Par1))’
The type variables ‘t0’, ‘t1’, ‘t2’, ‘t3’, ‘t4’, ‘t5’ are ambiguous
Expected type: Rep1 (F A) a
  Actual type: M1 t0 t1 (M1 t2 t3 (M1 t4 t5 Par1)) a
In the pattern: M1 (M1 (M1 g1))
In an equation for ‘to1’: to1 (M1 (M1 (M1 g1))) = AData (unPar1 g1)
In the instance declaration for ‘Generic1 (F A)’

whereas ghc 7.6.3 simply refuses to go ahead with the message:

generic1.hs:14:40:
    Derived instance `Generic1 (F A)'
      requires illegal partial application of data type family F
    In the data instance declaration for `F'

Either a check has gone missing in 7.8.x, or a bug has crept up in the Generic1 support. I have gone through past tickets and #5936 (closed) suggests that it is the latter.

Trac metadata
Trac field Value
Version 7.8.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
7.8.4
Milestone
7.8.4 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#9563