[Nix-dev] OOP library for Nix.

Ben Doyle ben.doyle at skedge.me
Mon May 12 18:01:32 CEST 2014


I'll admit I was a bit put off by the "object-oriented" name. But the wreq
example is pretty compelling: it's never the right thing to build a haskell
package against two different versions of the same library, but I hadn't
known a good way to express
that constraint in Nix.

I'll definitely try it out --- it might have saved me a couple days of
manual dependency chasing last month...

Perhaps `mapOverride` would be a good name for overrideScope? From the
outside it looks a bit like mapping into a tree.


On Fri, May 9, 2014 at 10:34 PM, <roconnor at theorem.ca> wrote:

> I would like to invite you all to 'checkout' my HaskellPackagesFixpoint
> branch.  I have added a little library for "object oriented programming"
> called lib/oop.nix.  Really, it is a library for manipulating open
> recursive functions, but it is couched in object oriented terminology.
>
> The branch contain a little application of the OOP library to
> haskell-packages.  In master, the wreq package is defined as
>
>   wreq = callPackage ../development/libraries/haskell/wreq {
>     aeson = self.aeson.override { attoparsec = self.attoparsec_0_11_3_0; };
>     attoparsec = self.attoparsec_0_11_3_0;
>     lens = self.lens.override {
>       aeson = self.aeson.override { attoparsec = self.attoparsec_0_11_3_0;
> };
>     };
>   };
>
> However, in my branch it is simply defined as
>
>   wreq = overrideScope ../development/libraries/haskell/wreq (self : {
>     attoparsec = self.attoparsec_0_11_3_0;
>   });
>
> The overrideScope function is a variant of callPackage where instead of
> overriding the package arguments, the scope is extended.  The
> overrideScope takes advantage of the oop.nix library.
>
> Another, more intricate, example can be found in
> ghc6122Prefs.cabalInstall_1_16_0_2 in haskell-defaults.nix which uses both
> extendScope (which is defined in overrideScope) and override.
>
> I'm planning to play around with this code a little more before asking to
> commit it to mainline.  Please feel free to try it out.  I'm not very good
> at naming things so send any suggestions my way.  I'm particularly unhappy
> with the name "overrideScope" and moderately unhappy with the "nixClass"
> attribute (in oop.nix).
>
> --
> Russell O'Connor                                      <http://r6.ca/>
> ``All talk about `theft,''' the general counsel of the American Graphophone
> Company wrote, ``is the merest claptrap, for there exists no property in
> ideas musical, literary or artistic, except as defined by statute.''
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140512/0bae0d04/attachment.html 


More information about the nix-dev mailing list