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

Use GHC.Types.SPEC to fix compilation with shared:False #15

Closed
wants to merge 1 commit into from
Closed

Use GHC.Types.SPEC to fix compilation with shared:False #15

wants to merge 1 commit into from

Conversation

thomie
Copy link

@thomie thomie commented Jan 22, 2016

This fixes https://ghc.haskell.org/trac/ghc/ticket/8618, and allows uniplate to be installed when shared:False is set in ~/.cabal.

Edit: some more background information.

From compiler/specialise/SpecConstr.hs in the ghc repository:

Note [Forcing specialisation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

With stream fusion and in other similar cases, we want to fully
specialise some (but not necessarily all!) loops regardless of their
size and the number of specialisations.

We allow a library to do this, in one of two ways (one which is
deprecated):

  1) Add a parameter of type GHC.Types.SPEC (from ghc-prim) to the loop body.

  2) (Deprecated) Annotate a type with ForceSpecConstr from GHC.Exts,
     and then add *that* type as a parameter to the loop body

The reason #2 is deprecated is because it requires GHCi, which isn't
available for things like a cross compiler using stage1.

So the issue here goes something like this:

  • uniplate used ForceSpecConstr
  • ForceSpecConstr requires GHCi to run
  • since ghc-7.8, GHCi requires shared libraries to be built
  • shared:false disables building shared libraries
  • error

This commit changes uniplate to use GHC.Types.SPEC instead of ForceSpecConstr, as suggested by that Note.

GHC.Types.SPEC was added to ghc-prim 0.3.1.0 / GHC 7.8.1 [1]. It's magic is partially explained in [2]. I made a similar pull request for vector in [3].

[1] https://downloads.haskell.org/~ghc/7.8.1/docs/html/users_guide/release-7-8-1.html
[2] http://git.haskell.org/ghc.git/commitdiff/cee3adbcc180bdf1be8b24aeaafa2ca4a737cbbf
[3] haskell/vector#83

@ndmitchell
Copy link
Owner

Thanks for the patch! I have managed to get myself wedged with a load of local changes in Uniplate that are in a state I don't want to merge or lose, which is both annoying, and means that the time to merge in this patch will probably be a month or so. But the patch looks good and I will merge.

@langston-barrett
Copy link

Ping @ndmitchell

@ndmitchell
Copy link
Owner

Many apologies this patch took 4 years to get in. I took the code and reapplied it to master, as part of #31. Thanks very much, and sorry life got away from me.

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.

None yet

3 participants