Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't import Prelude in the generated Build_doctests modules. #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

quasicomputational
Copy link
Contributor

Prelude is a magical module name, and it may be useful for users
to define their own Prelude modules which may not coincide with
the Prelude from base.

Prelude is a magical module name, and it may be useful for users
to define their own Prelude modules which may not coincide with
the Prelude from base.
@phadej
Copy link
Collaborator

phadej commented Feb 26, 2018

What restricts people to redefine Data.Maybe?

I'm very skeptical about redefining Prelude, given where Build_doctest is intended to be used. I'm not against this change but I'm curious what's the setup where this is required?

@quasicomputational
Copy link
Contributor Author

Data.Maybe isn't magical in the same way that Prelude is. Re-defining Prelude is the only way to bring things in scope without an import. This is less of a problem with doctests because $setup stanzas exist, but it's a configuration I can imagine existing.

@phadej
Copy link
Collaborator

phadej commented Feb 26, 2018

@quasicomputational note that the Build_doctest is used to compile doctests test-suite executable, a doctest like executable. It's not the code which doctest ever sees & executes & tests.

You'd need to have contrived:

test-suite doctests
  type:                exitcode-stdio-1.0
  main-is:             doctests.hs
  build-depends:
    -- note: not `base`
    my-better-base,
    doctest >= 0.11.3 && <0.14,
    QuickCheck ==2.10.*,
    simple-example,
    template-haskell

  ghc-options:         -Wall -threaded
  hs-source-dirs:      tests
  default-language:    Haskell2010

to break in way your change is required. I don't want to encourage this use case. Generated code assumes dependency on base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants