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,257
    • Issues 4,257
    • 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
  • Wiki
  • export lists

Last edited by Matthew Pickering Aug 07, 2016
Page history New page

export lists

This page gives a specification for how users should expect export lists to behave.

Specifically, we concentrate on the very complex case of type constructors exported with data constructors.

Syntax

We are concerned with exports of the form.

T(a_1, a_2, ..., a_n)

where a_1 to a_n are a mixture of

  1. Data Constructors
  2. Record Selectors
  3. Class methods
  4. Type Constructors (in the case of associated types)
  5. Pattern Synonyms
  6. Pattern Synonym Record Selectors
  7. Wildcards

We then define two cases for each category.

  1. When it is valid to include in the export list.
  2. Which names are exported as a result of the inclusion.

We say that a_1 can be *exported with* T in the case that the export is 1-valid.

Definition:

Semantics

  1. A data constructor D can be exported with T just when T is the parent of D.

  2. A record selector f can be exported with T just when T is the parent of D.

  3. A type class method foo can be exported with T just when T is a type class which defines foo.

  4. A type constructor S can be exported with T just when S is an associated type defined in the type class T.

  5. A pattern synonym P can be exported with T in the case that either

  6. The head of the type of the scrutinee is a definite type constructor (not a type variable) S and T = S.

  7. The head of the type of the scrutinee is a type variable

  8. A pattern synonym selector p belonging to a pattern synonym P can be exported with T in the case that P can be exported with T.

  9. A wildcard can always appear in the export list.

1-5. The thing itself is exported from the module.

  1. All children of T are exported from the module.
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