Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,868
    • Issues 4,868
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17015
Closed
Open
Created Aug 01, 2019 by yairchu@yairchu

More general Eq+Ord+Read+Show instances for Data.Functor.Product

Motivation

Data.Functor.Product currently has instances for Eq, Ord, Read, and Show which are based on Eq1, Ord1, Read1, and Show1, which implicitly assume that:

  • The a type variable in Product f g a has a representational role
  • The f and g type variables have kind Type -> Type

These assumptions are not always correct, for example:

  • There's no reason that Eq (Product (Const Int) (Const Bool) a) should require Eq a, but it does
  • PolyKinds instances of Product can't currently have Eq instances because Eq1 can't be provided for f because it has the wrong kind

When needing these instances, the problem currently cannot be worked around using orphan instances, as those overlap the original instances.

Proposal

Replace the current limited Eq, Ord, Read, and Show instances of Product with more general instances.

This is a matter of simply removing the current instances and adding , Eq, Ord, Read, Show to Product's deriving clause.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking