Skip to main content

Improving IFD

pennae's idea:

magic_ifd_primop = \f i -> import f >>= i
# nix:
importAndThen (res: <stuff>) some-ifd.outPath

Observation: a magic IFD primop that immediately does something to the result of an import can be "thunked" (thus processed in the background) and offer an "interesting" fix to IFDs. We cannot just make import be lazy because of the evaluator internals.

Subsequent observations:

  • Explicit monads in Nix may be interesting
  • Explicit monads are not necessary if everything "monadic" is related to continuations
  • Thunked continuation "entities" / "objects" are sufficient

Why is this interesting?

The capability of forking / parallelizing the work.

Questions:

  • jade: how do you generalize this over all the ways that one can consume things via IFD (readFile, etc)?