1

I'm trying to install the lens package to work with haskell.

$ haste-inst install lens

I get the following error:

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: base-4.6.0.1/installed-4.6... (user goal)
trying: containers-0.4.1.0/installed- (user goal)
trying: lens-4.9.1 (user goal)
next goal: template-haskell (dependency of lens-4.9.1)
rejecting: template-haskell-2.10.0.0 (conflict:
base==4.6.0.1/installed-4.6..., template-haskell => base==4.8.*)
rejecting: template-haskell-2.9.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.7.*)
rejecting: template-haskell-2.8.0.0 (conflict: containers==0.4.1.0/installed-,
template-haskell => containers==0.5.*)
rejecting: template-haskell-2.7.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.5.*)
rejecting: template-haskell-2.6.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.4.*)
rejecting: template-haskell-2.5.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.3.*)
rejecting: template-haskell-2.4.0.1 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base==4.2.*)
rejecting: template-haskell-2.4.0.0 (conflict: base==4.6.0.1/installed-4.6...,
template-haskell => base>=3 && <4.3)
rejecting: template-haskell-2.3.0.1, 2.3.0.0, 2.2.0.0 (conflict: lens =>
template-haskell>=2.4 && <2.11)
Backjump limit reached (change with --max-backjumps).

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

I believe the sandbox "Note" to be misleading. The sandbox is new and base cannot exist in the sandbox anyway.

What determines the version of base for haste? Installing lens with cabal (for haskell) works fine:

cabal install lens

Edit:

lens-family has worked well as a substitute so far.

worldsayshi
  • 1,788
  • 15
  • 31
  • Oh, I see, [here's what determines the version of haste's version of base](https://github.com/valderman/haste-compiler/blob/master/libraries/base-ghc-7.8/base.cabal) - base is merged and patched from the original in the haste code base. – worldsayshi Apr 23 '15 at 21:47
  • So the "obvious" problem is that the version of template haskell that support the supplied base package doesn't support the installed containers package. It seems that I'm not allowed to reinstall inside the sandbox. Outside it seems to work.. – worldsayshi Apr 23 '15 at 22:02
  • Hmm, I think that the solution is to just avoid sandboxes when it comes to haste. I'll try it later. – worldsayshi Apr 23 '15 at 22:15
  • Why do you have containers 0.4.1.0 installed? Surely you want at least 0.5.0.0 which is the version that came with GHC 7.6? – Reid Barton Apr 23 '15 at 22:17
  • Yes, not sure why. I installed newest container globally but got new errors when trying again with lens. I'll try again later. – worldsayshi Apr 23 '15 at 22:19
  • 1
    Don't install any containers package, just stick to the one that came with GHC. (Or haste, I guess... not sure how package management works with haste, but in general you should only use the template-haskell that came with your compiler, and since containers is a dependency of template-haskell, the same goes for containers.) – Reid Barton Apr 23 '15 at 22:32
  • So I'm stuck with whatever containers that pairs up with base 4.6.0.1 then – worldsayshi Apr 23 '15 at 22:41

1 Answers1

1

Lens depends on Template Haskell which, unfortunately, is not currently supported by Haste.

The way base is currently implemented for Haste makes TH support tricky. However, GHC 7.10 support will require some significant reshuffling anyway, so TH support will probably arrive together with 7.10.

valderman
  • 8,365
  • 4
  • 22
  • 29
  • I see. Seems the best alternative for getting lenses for haste is to try [lens-family](https://hackage.haskell.org/package/lens-family) then. More manual work but much more minimalistic with dependencies. – worldsayshi Apr 24 '15 at 13:54
  • 1
    A bit further into my project now. lens-family seems to work great so far. (I had to make some lenses myself with the side effect of understanding lenses better.) – worldsayshi May 11 '15 at 22:00
  • For other purposes I thought a bit on wether there could be a workaround for not having TH support. Here are some potential leads: [1](http://stackoverflow.com/questions/8520170/preferred-method-for-viewing-code-generated-by-template-haskell) [2](http://stackoverflow.com/questions/16621582/how-to-create-a-non-th-package-from-code-generated-using-template-haskell?rq=1) – worldsayshi Jun 01 '15 at 14:20