Skip to main content

haskell_inline

Macro haskell_inline 

Source
haskell_inline!() { /* proc-macro */ }
Expand description

Embeds inline Haskell source as a Core expression with its DataConTable.

Writes the Haskell source to a temporary file, compiles it via nix run .#tidepool-extract, and embeds the resulting CBOR.

Supports include paths for importing local Haskell modules.

§Returns

Returns (tidepool_repr::CoreExpr, tidepool_repr::DataConTable).

§Examples

let (expr, table) = haskell_inline! {
    target = "game",
    include = "haskell",
    r#"
        import Effects

        game :: Eff '[Console, Rng] ()
        game = do
          target <- randInt 1 100
          emit "I'm thinking of a number between 1 and 100."
          guessLoop target
    "#
};