Skip to content

Instantly share code, notes, and snippets.

@DanBurton
Last active March 9, 2019 18:18
Show Gist options
  • Save DanBurton/bf79410a9ed639bcd3d66dac58b645d3 to your computer and use it in GitHub Desktop.
Save DanBurton/bf79410a9ed639bcd3d66dac58b645d3 to your computer and use it in GitHub Desktop.
Convenience of "extend", implemented with "override"
self: super:
let
r = rec {
# addExtendo : haskellPackages -> extension
addExtendo = newHp: _: _: {
extendo = hpExtendo newHp;
};
# hpExtendo : haskellPackages -> extension -> haskellPackages
# performs the extension, and also performs the addExtendo extension afterwards.
hpExtendo = hp: extension:
let x = rec {
newHp =
hp.override (old: {
overrides = super.lib.composeExtensions
(old.overrides or (_: _: {}))
(super.lib.composeExtensions extension (addExtendo newHp));
});
}; in x.newHp;
};
in rec {
haskellPackages = r.hpExtendo super.haskellPackages (_: _: {});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment