Skip to content

Mixins are not accounted when trying to hide Prelude #823

Closed
@Martoon-00

Description

@Martoon-00

Problem

In one of the projects, we are trying to use mixins feature to hide the default Prelude module and provide our own, in overall this looks like

# package.yaml
depedencies:
  - name: base
    version: ">= 4.7 && < 5"
    mixin: [hiding (Prelude)]
  - morley-prelude

However, it looks like hiding Prelude does not work, because with ghcide I get the following error

Ambiguous module name ‘Prelude’:
  it was found in multiple packages:
  base-4.13.0.0 morley-prelude-0.3.0

Reproduction

I can reproduce this in the Morley repository, commit e9a00b61bb.
It has morley-prelude package used as a custom prelude. When I open some of the depending packages, e.g. code/morley/src/Util/Text.hs file from morley package, I get the mentioned error for all modules.
There are other packages using morley-prelude where the problem reproduces, e.g. morley-ledgers has much less modules (in case that is helpful), but it appears in a different repository.

Side comments

Indeed, one of the options for us would be just not using mixins and instead use base-noprelude. We are going to apply this as a temporary workaround, though it would be nice if this feature is eventually supported.

I'm not sure how problematic this may be to fix, since it is a known issue that even stack ghci does not work with mixins properly, but would be nice to at least know your plans on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions