Skip to content

Provide hsc2hs replacement #31

Description

@chpatrick

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.

Activity

  1. bitonic commented on Aug 5, 2015

    @bitonic
    Collaborator

    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)?

  2. chpatrick commented on Sep 2, 2015

    @chpatrick
    ContributorAuthor

    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.

  3. ekmett commented on Jun 3, 2019

    @ekmett
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions