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,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 378
    • Merge Requests 378
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15534

Closed
Open
Opened Aug 17, 2018 by David Feuer@treeowlReporter

Allow associated types in Minimal pragmas

Missing associated type definitions can cause compile-time problems similar to the run-time problems that occur when necessary methods are missing.

{-# language TypeFamilies, UndecidableInstances #-}

class Foo a where
  type X a
  type X a = Y a

  type Y a
  type Y a = X a

instance Foo Int

bob :: X Int
bob = undefined

Compiling this gives

Minim.hs:14:7: error:
    • Reduction stack overflow; size = 201
      When simplifying the following type: Y Int
      Use -freduction-depth=0 to disable this check
      (any upper bound you could choose might fail unpredictably with
       minor updates to GHC, so disabling the check is recommended if
       you're sure that type checking should terminate)
    • In the expression: undefined
      In an equation for ‘bob’: bob = undefined
   |
14 | bob = undefined

That's not exactly the best error message in the world. I would like to be able to write

  {-# MINIMAL X | Y #-}

which would mean that instances should give type instances for X or Y. I don't see any reason to prohibit mixing associated types and methods in a single MINIMAL pragma.

Trac metadata
Trac field Value
Version 8.4.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
9.2.1
Milestone
9.2.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#15534