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

Provide hsc2hs replacement #31

Open
chpatrick opened this issue Jul 12, 2015 · 3 comments
Open

Provide hsc2hs replacement #31

chpatrick opened this issue Jul 12, 2015 · 3 comments

Comments

@chpatrick
Copy link
Contributor

It would be really cool if inline-c could do some stuff that we use hsc2hs for currently, ie. sizeOf and friends. It would remove the need to include stuff twice and would be much nicer with template haskell than the print-out-the-whole-source-with C approach.

@bitonic
Copy link
Collaborator

bitonic commented Aug 5, 2015

Well, you can already do

[C.exp| sizeof (int) |]

The problem is that it will be executed each time rather than known statically.

Do you mean that we should be able to execute C code statically and embed results (a-la TemplateHaskell, but with C)?

@chpatrick
Copy link
Contributor Author

Yes, that's what I meant. It would be nice because it would ensure that it runs in the same C environment as the inline-c code, and it would be much more extensible than hsc's macro hacks.

@ekmett
Copy link
Contributor

ekmett commented Jun 3, 2019

It isn't clear to me that this is very possible.

hsc2hs can do things like splice into import lists and even emit additional haskell language directives above the very module signature, because all it is doing is building a c program that will print a haskell program. It does its work on source text, not template-haskell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants