From efde6255720ca9625f81d6bce9ec20dbac942e2e Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Mon, 18 Oct 2021 21:23:10 +0800 Subject: [PATCH] haskellPackages.recursion-schemes: Fix profiling objects Thanks to Ryan's patch here https://github.com/recursion-schemes/recursion-schemes/issues/128\#issuecomment-911632813 Fixes https://github.com/NixOS/nixpkgs/issues/140613 --- .../haskell-modules/configuration-common.nix | 4 ++++ .../patches/recursion-schemes-128.patch | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/haskell-modules/patches/recursion-schemes-128.patch diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 3d98bcdaed88..1afa282a1785 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -2050,4 +2050,8 @@ EOT network = self.network_3_1_2_5; }); + # Fixes https://github.com/NixOS/nixpkgs/issues/140613 + # https://github.com/recursion-schemes/recursion-schemes/issues/128 + recursion-schemes = appendPatch super.recursion-schemes ./patches/recursion-schemes-128.patch; + } // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super diff --git a/pkgs/development/haskell-modules/patches/recursion-schemes-128.patch b/pkgs/development/haskell-modules/patches/recursion-schemes-128.patch new file mode 100644 index 000000000000..a40efc6f6334 --- /dev/null +++ b/pkgs/development/haskell-modules/patches/recursion-schemes-128.patch @@ -0,0 +1,24 @@ +diff --git a/recursion-schemes.cabal b/recursion-schemes.cabal +index c35f2c6..e692ade 100644 +--- a/recursion-schemes.cabal ++++ b/recursion-schemes.cabal +@@ -93,6 +93,7 @@ library + Paths_recursion_schemes + + ghc-options: -Wall ++ ghc-prof-options: -DPROFILING_ENABLED + if impl(ghc >= 8.6) + ghc-options: -Wno-star-is-type + default-language: Haskell2010 +diff --git a/src/Data/Functor/Foldable/TH.hs b/src/Data/Functor/Foldable/TH.hs +index b3d5ac8..d4ef0e4 100644 +--- a/src/Data/Functor/Foldable/TH.hs ++++ b/src/Data/Functor/Foldable/TH.hs +@@ -1,4 +1,7 @@ + {-# LANGUAGE CPP, PatternGuards, Rank2Types #-} ++#if defined(PROFILING_ENABLED) ++{-# OPTIONS_GHC -O0 #-} ++#endif + module Data.Functor.Foldable.TH + ( MakeBaseFunctor(..) + , BaseRules