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

Document using the same Package in an Executable #396

Open
jkarni opened this issue Nov 10, 2023 · 1 comment
Open

Document using the same Package in an Executable #396

jkarni opened this issue Nov 10, 2023 · 1 comment

Comments

@jkarni
Copy link
Contributor

jkarni commented Nov 10, 2023

For compiled languages especially, I'd like to be able to do something like this:

import * as garn from "http://localhost:8777/mod.ts";
import * as nixpkgs from "http://localhost:8777/nixpkgs.ts";

export const helloFromHaskell = garn.haskell
  .mkHaskellProject({
    description: "My haskell executable",
    executable: "helloFromHaskell",
    compiler: "ghc94",
    src: ".",
  })
  .addExecutable("foo")`${helloFromHaskell.pkg}/bin/helloFromHaskell`;

But this doesn't work because the variable is used before it is assigned.

We can separate it out into two steps:

import * as garn from "http://localhost:8777/mod.ts";
import * as nixpkgs from "http://localhost:8777/nixpkgs.ts";

const helloFromHaskell = garn.haskell
  .mkHaskellProject({
    description: "My haskell executable",
    executable: "helloFromHaskell",
    compiler: "ghc94",
    src: ".",
  })

export const helloFromHaskell2 = helloFromHaskell
  .addExecutable("foo")`${helloFromHaskell.pkg}/bin/helloFromHaskell`;

But it's not obvious that this is what we need to do (it's not obvious the .add methods don't mutate the object, for example, and that we shouldn't be using a var), so it'd be nice to document this somewhere (e.g. a cookbook).

@soenkehahn
Copy link
Contributor

With #372 our recommendation may change.

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

2 participants