8000 Please, how to add a package name into mixin? · Issue #453 · sol/hpack · GitHub
[go: up one dir, main page]

Skip to content

Please, how to add a package name into mixin? #453

Open

Description

@Anton-Latukha

For example, the main way to setup relude is:
(in the form of Cabal specification):

 mixins:
    base hiding (Prelude)
  , relude (Relude as Prelude)
  , relude

Full example:

  build-depends:
      base
    , relude

  mixins:
      base hiding (Prelude)
    , relude (Relude as Prelude)
    , relude

HPack allows to:

  - name: base
    mixin:
      - hiding (Prelude)
  - name: relude
    mixin:
      - (Relude as Prelude)

But into Cabal it gets translated as:

  build-depends:
    - relude

  mixins:
      base hiding (Prelude)
    , relude (Relude as Prelude)

Which has unexpected behavior - any modules except main Relude module from the tree of relude modules can not be imported.

If only there was a documented way, or if I knew the way to do something like:

  - name: base
    mixin:
      - hiding (Prelude)
  - name: relude
    mixin:
      - (Relude as Prelude)
      - 
      # (or)
      - relude
      # (or)
    - mixin

To put that - relude the second time - it all seems to work fine then if that gets possible.

Activity

  1. changed the title [-]How to add a package name into mixin[/-] [+]How to add a package name into mixin?[/+] on Sep 20, 2021
  2. changed the title [-]How to add a package name into mixin?[/-] [+]Please, how to add a package name into mixin?[/+] on Sep 20, 2021
  3. philderbeast commented on Mar 16, 2022

    @philderbeast
    Contributor

    @Anton-Latukha I'm doing something similar with ghc-corroborate. Adding a hiding () item could get you what you want.

    -- package.dhall
                    , dependencies =
                      [ { name = "ghc"
                        , version = ">=8.0 && <8.2"
                        , mixin =
                          [ "hiding ()"
                          , "(TcRnTypes as TcRnTypes)"
                          , "(Type as Type)"
                          , "(TcRnTypes as Constraint)"
                          , "(Type as Predicate)"
                          ]
                        }
                      ]
    # generated from package.dhall with "dhall-hpack-yaml > package.yaml"
        dependencies:
        - name: ghc
          version: '>=8.0 && <8.2'
          mixin:
          - hiding ()
          - (TcRnTypes as TcRnTypes)
          - (Type as Type)
          - (TcRnTypes as Constraint)
          - (Type as Predicate)
    -- generated ghc-corroborate.cabal with "dhall-hpack-cabal"
        build-depends:
            ghc >=8.0 && <8.2
        mixins:
            ghc hiding ()
          , ghc (TcRnTypes as TcRnTypes)
          , ghc (Type as Type)
          , ghc (TcRnTypes as Constraint)
          , ghc (Type as Predicate)
  4. philderbeast commented on Mar 16, 2022

    @philderbeast
    Contributor

    I tried adding an empty string entry and this adds the dependency to the mix as-is.

    # package.yaml
        dependencies:
        - name: ghc
          version: '>=8.0 && <8.2'
          mixin:
          - ''
    -- generated ghc-corroborate.cabal
        build-depends:
            ghc >=8.0 && <8.2
        mixins:
            ghc 
  5. added a commit that references this issue on Mar 16, 2022
    5e525ef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      0