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

Error on cabal sandbox-configure with "installed" constraint #1159

Closed
bmillwood opened this issue Dec 24, 2012 · 3 comments · Fixed by #1163
Closed

Error on cabal sandbox-configure with "installed" constraint #1159

bmillwood opened this issue Dec 24, 2012 · 3 comments · Fixed by #1163
Assignees

Comments

@bmillwood
Copy link
Contributor

I have the following in my .cabal/config:

constraint: template-haskell installed

When I do a cabal sandbox-init I get a cabal.sandbox.config containing the following lines:

-- inherit:
constraints: template-haskell installed

Then cabal sandbox-configure says:

cabal: Error parsing package environment file
/home/ben/haskell/fay/cabal.sandbox.config:15:
Ambiguous parse in field 'constraints'.

With a constraint other than installed (specifying the version, for example), it works fine.

@ghost ghost assigned 23Skidoo Dec 24, 2012
@23Skidoo
Copy link
Member

Thanks, will look into this.

@23Skidoo
Copy link
Member

Interesting: parsing "template-haskell installed" with readUserConstraint returns UserConstraintInstalled (PackageName "template-haskell"), but parsing the same string with parse returns [UserConstraintInstalled (PackageName "template-haskell"),UserConstraintFlags (PackageName "template-haskell") [(FlagName "installed",True)]].

Looks like the ambiguity was always there, and I just triggered it by using parseCommaList parse.

@23Skidoo
Copy link
Member

The bug was caused by missing parentheses in the UserConstraint parser: +++ and <++ are right-associative, so a +++ b +++ c <++ d is parsed as (a +++ (b +++ (c <++ d))).

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 a pull request may close this issue.

2 participants