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,391
    • Issues 4,391
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 372
    • Merge Requests 372
  • 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
  • #12679

Closed
Open
Opened Oct 10, 2016 by Edward Z. Yang@ezyangDeveloper

Permit abstract data types in signatures that don't have kind *

Here is a fascinating program that I would like to write, but cannot with Backpack today:

unit p where
    signature Key where
        import GHC.Exts (Constraint)
        data Key k :: Constraint
        instance Key Bool
    signature Map where
        import Key
        data Map k a
        empty :: Map k a
        insert :: Key k => k -> a -> Map k a -> Map k a
        lookup :: Key k => k -> Map k a -> Maybe a
    module M where
        import Map
        import Key
        x = insert True "foo" empty

The point is to make the *constraint* for Map parametrizable, so that HashMap can levy a different constraint (Hashable) than Map (Ord).

data Key k :: Constraint is implementable, because we can implement abstract data types using type synonyms in Backpack, and synonyms can have more kinds than just *. However, GHC chokes on this declaration, because it thinks that data types always have to have kind *.

Edited Mar 10, 2019 by Edward Z. Yang
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#12679