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

Automatically generated temporary modules have invalid names under base-4.10 #32

Closed
byorgey opened this issue Sep 27, 2017 · 2 comments
Closed

Comments

@byorgey
Copy link
Member

byorgey commented Sep 27, 2017

See this StackOverflow question.

diagrams-builder calls openTempFile (see here) to get a temporary file in which to output a Haskell module. It then uses the base name of the resulting file as the name of the module (as is required).
Although the documentation for openTempFile says the created file will have a name of the form "fooXXX.ext where XXX is some random number", the behavior of openTempFile changed recently so that it now always includes a hyphen (I think this was released in base-4.10). The problem is that a hyphen cannot be part of a Haskell module name, so now diagrams-builder fails with parse errors when it tries to compile the auto-generated modules.

@byorgey
Copy link
Member Author

byorgey commented Sep 27, 2017

We might be able to use a module name that differs from the filename, if we are directly loading the file. If so that would definitely seem to be the right solution.

@byorgey
Copy link
Member Author

byorgey commented Sep 27, 2017

Look here: https://github.com/diagrams/diagrams-builder/blob/master/src/Diagrams/Builder.hs#L100 Do we really need to call setTopLevelModules with takeBaseName m? Will that work if the module name is not the same as the file name? (For a start we would need to pass the module name separately.)

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

No branches or pull requests

1 participant