Hi.

On 12/16/2014 03:30 AM, Carlo Nucera wrote:
In the line `packages = pkgs self;` what does `self` refer to?

Obviously, ``self`` is the parameter of the whole haskell-packages.nix top-level function (line 58 in recent master version).

I gather that pkgs, the value we should pass to ghcWithPackages, has
to be a function, to be called on self;
but what should this function do?

For a practical example see e.g.
https://nixos.org/wiki/Haskell#Local_use_via_myEnvFun

An attempt to explain what is ``self`` good for:

When constructing the haskell package attrmaps, you shouldn't use direct references to packages, but access them through the ``self`` attrmap. That is a standard (lazy-eval) mechanism for modifiable constructs. You construct the final result by composing parts, perhaps applying additional modifications to base expressions. In order for the parts to have access to these "external" changes, you pass the *final* result to each of the parts (result is called ``self`` here; laziness is needed to do that).


Vladimir


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to