anchor.diff:    installPhase = ''
       runHook preInstall
   
  -    ${if !hasActiveLibrary then "${setupCommand} install" else ''
  +    ${if !isLibrary then "${setupCommand} install" else ''
         ${setupCommand} copy
         local packageConfDir="$out/lib/${ghc.name}/package.conf.d"
         local packageConfFile="$packageConfDir/${pname}-${version}.conf"
  
positive.code:                      main = defaultMain
                     '';
  
    hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling || hostPlatform.isWindows);
  
    # We cannot enable -j<n> parallelism for libraries because GHC is far more
    # likely to generate a non-determistic library ID in that case. Further
    # details are at <https://github.com/peti/ghc-library-id-bug>.
    enableParallelBuilding = (versionOlder "7.8" ghc.version && !hasActiveLibrary) || versionOlder "8.0.1" ghc.version;
  
    crossCabalFlags = [
      "--with-ghc=${ghc.targetPrefix}ghc"
  
negative.code: 
    haddockPhase = ''
      runHook preHaddock
      ${optionalString (doHaddock && isLibrary) ''
        ${setupCommand} haddock --html \
          ${optionalString doHoogle "--hoogle"} \
          ${optionalString (isLibrary && hyperlinkSource) "--hyperlink-source"}
      ''}
      runHook postHaddock
    '';
  