Skip to content

Modules are permitted to re-export a type class and a type of the same name #3502

@hdgarrood

Description

@hdgarrood

Currently, it's possible to re-export a type and a type class of the same name from a module, even though it's not possible to define a type and a type class of the same name together in one module. For example,

-- Eg.Type.purs
module Eg.Type where

data X = X

-- Eg.Class.purs
module Eg.Class where

class X a

-- Eg.purs
module Eg (module Type, module Class) where

import Eg.Type (X)
import Eg.Class (class X)

There is an example of this in purescript-typelevel-prelude at version 3.0.0, where the module Type.Row re-exports the class Cons from Prim.Row as well as the type Cons from Prim.RowList. At the moment, this is only a minor issue; as far as I'm aware, the only problem this can cause is that it can break anchor links in docs. However, if we ever want to do #1888 (which do still I think we should), I think we will need to make this an error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions