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 396
    • Merge Requests 396
  • 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
  • Wiki
  • type functions iface

Last edited by chak May 07, 2007
Page history New page

type functions iface

Type Functions: Interface

Representation of family instances

The IfaceSyn.IfaceData variant of IfaceDecl contains a new ifFamInst :: Maybe (IfaceTyCon, [IfaceType]) field that distinguishes ordinary data/newtype declarations from family instances. In the latter case, the (IfaceTyCon, [IfaceType]) value gives the family instance type. In addition, each family instance is represented by a value of type IfaceFamInst that includes the instances rough match (i.e., name of the family type and a [Maybe IfaceTyCon] value that gives the outermost type constructor of each index argument for that instance) and refers to the type declaration for full details (as a class instance does with its dfun).

Moreover, much like class instances, family instance heads of a module are collected in the new mi_fam_insts :: [IfaceFamInst] field of HscTypes.ModIface. This allows to enter the rough matches into the ExternalPackageState or ModDetails, when reading the interface, without having to parse the full tycon that represents the instance yet. This in turn avoids pulling in everything that hangs of that tycon.

Module dependencies due to family instances

To avoid superfluous (i.e., already previously performed overlap checks), each ModIface keeps a list of the modules it depends on that contain family instances. This information is in the field dep_finsts of HscTypes.Dependencies. Moreover, the field mi_finsts indicates whether there are an family instances in the current module. When importing a module (in RnNames.rnImportDecl), this information (mi_finsts and dep_finsts combined) makes its way into ImportAvails.

Clone repository

GHC Home
GHC User's Guide

Joining In

Newcomers info
Mailing Lists & IRC
The GHC Team

Documentation

GHC Status Info
Working conventions
Building Guide
Debugging
Commentary

Wiki

Title Index
Recent Changes