Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Fix: Generate pattern signatures for constructors exported as patterns #663

Merged
merged 5 commits into from
Aug 6, 2017

Conversation

timjb
Copy link
Contributor

@timjb timjb commented Aug 5, 2017

This pull request also fixes a bug in the representation of pattern synonyms: Since pattern synonyms have two different contexts, we must render each context even if it is empty.

timjb added 4 commits August 6, 2017 00:12
Pattern synonyms can have up to two contexts, both having a
different semantic meaning: The first holds the constraints
required to perform the matching, the second contains the
constraints provided by a successful pattern match. When the
first context is empty but the second is not it is necessary
to render the first, empty context.
It is not necessary to generate the simplest type signature since
it will be simplified when pretty-printed.
extractPatternSyn :: Name -> Name -> [LHsType Name] -> [LConDecl Name] -> LSig Name
extractPatternSyn nm t tvs cons =
case filter matches cons of
[] -> error "extractRecSel: constructor pattern not found"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be extractPatternSyn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@alexbiehl alexbiehl merged commit 3fddb62 into haskell:master Aug 6, 2017
dmalikov added a commit to alexbiehl/haddock that referenced this pull request Aug 6, 2017
* origin/master:
  Fix: Generate pattern signatures for constructors exported as patterns (haskell#663)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants