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

Redundant quantification when rendering GADT constructors from external packages #1015

Closed
@RyanGlScott

Description

@RyanGlScott

(Yet another issue noticed in well-typed/generics-sop#92.)

Run Haddock on this code:

module Bug ((:~:)(..)) where

import Data.Type.Equality

And you'll get this:

haddock

Notice that the type signature for Refl quantifies b, which is completely redundant! The culprit is these lines of code:

if use_gadt_syntax
then return $ noLoc $
ConDeclGADT { con_g_ext = noExt
, con_names = [name]
, con_forall = noLoc True
, con_qvars = synifyTyVars (univ_tvs ++ ex_tvs)

This is constructing a type signature for a GADT constructor by displaying all of the universally quantified type variables following by the existentially quantified type variables. But this is not always what the user has written, as shown in the example above. We really ought to be using dataConUserTyVars instead, which takes this information into account.

Patch incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions