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

(Optionally) copy '-package-id' args from 'stack' #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

afcady
Copy link

@afcady afcady commented Jan 10, 2016

If the environment variable 'HALIVE_STACK_COMPONENT' is set, its value
will be passed to 'stack ghci' as the component to use. The command
line used to launch 'ghci' is extracted from 'stack' log output, and the
'-package-id=<...>' arguments used to configure the 'DynFlags' passed to
'runGhc'.

This is necessary when the stack package dbs contain multiple packages
that provide the same module. Without it, 'runGhc' will not be able to
know which package should be used to provide the module, producing an
error such as this:

demo/Shader.hs:3:8:
Ambiguous module name ‘Graphics.GL’:
it was found in multiple packages:
gl-0.7.7@gl_8feL1KNX30C7cRvC5KMerD OpenGLRaw-3.0.0.0@OpenG_2ifknuoKtb4Jnk98tmsl6Y

This is very slow, since it has to compile the project with 'ghci' just
to get the arguments -- only to be used to compile it again! But it
does make 'halive' work in situations where, without it, there would
only be failure.

(A proper solution would involve modifying 'stack' to provide this
information more efficiently.)

Andrew Cady added 3 commits January 9, 2016 21:16
If the environment variable 'HALIVE_STACK_COMPONENT' is set, its value
will be passed to 'stack ghci' as the component to use.  The command
line used to launch 'ghci' is extracted from 'stack' log output, and the
'-package-id=<...>' arguments used to configure the 'DynFlags' passed to
'runGhc'.

This is necessary when the stack package dbs contain multiple packages
that provide the same module.  Without it, 'runGhc' will not be able to
know which package should be used to provide the module, producing an
error such as this:

  demo/Shader.hs:3:8:
      Ambiguous module name ‘Graphics.GL’:
        it was found in multiple packages:
        gl-0.7.7@gl_8feL1KNX30C7cRvC5KMerD OpenGLRaw-3.0.0.0@OpenG_2ifknuoKtb4Jnk98tmsl6Y

This is very slow, since it has to compile the project with 'ghci' just
to get the arguments -- only to be used to compile it again!  But it
does make 'halive' work in situations where, without it, there would
only be failure.

(A proper solution would involve modifying 'stack' to provide this
information more efficiently.)
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.

1 participant