Document using the same Package in an Executable
Opened this issue · 1 comments
jkarni commented
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 commented
With #372 our recommendation may change.