[Nix-dev] OOP library for Nix.

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Mon May 26 02:44:22 CEST 2014


On 05/10/2014 04:34 AM, 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).
> 

Are there plans to have this in nixpkgs master? I just had to manual
dependency overriding and remembered this e-mail.

I also think that the OOP name is unfortunate.

-- 
Mateusz K.


More information about the nix-dev mailing list