anchor.diff:  # This will build mmorph and monadControl, and have the hoogle installation
   # refer to their documentation via symlink so they are not garbage collected.
   
  -{ lib, stdenv, hoogle, rehoo
  +{ lib, stdenv, hoogle, rehoo, writeText
   , ghc, packages ? [ ghc.ghc ]
   }:
   
   let
     inherit (stdenv.lib) optional;
     wrapper = ./hoogle-local-wrapper.sh;
  +  isGhcjs = ghc.isGhcjs or false;
  +  haddockExe =
  +    if !isGhcjs
  +    then "haddock"
  +    else "haddock-ghcjs";
  +  ghcName =
  +    if !isGhcjs
  +    then "ghc"
  +    else "ghcjs";
  +  docLibGlob =
  +    if !isGhcjs
  +    then ''share/doc/ghc*/html/libraries''
  +    else ''doc/lib'';
  +  # On GHCJS, use a stripped down version of GHC's prologue.txt
  +  prologue =
  +    if !isGhcjs
  +    then "${ghc}/${docLibGlob}/prologue.txt"
  +    else writeText "ghcjs-prologue.txt" ''
  +      This index includes documentation for many Haskell modules.
  +    '';
   in
   stdenv.mkDerivation {
     name = "hoogle-local-0.1";
  
positive.code:     }
  
      echo importing builtin packages
      for docdir in ${ghc}/share/doc/ghc*/html/libraries/*; do
        if [[ -d $docdir ]]; then
          import_dbs $docdir
          ln -sfn $docdir $out/share/doc/hoogle
  
negative.code:         args="$args --read-interface=$name_version,$hdfile"
      done
  
      ${ghc}/bin/${haddockExe} --gen-index --gen-contents -o . \
           -t "Haskell Hierarchical Libraries" \
           -p ${prologue} \
           $args
  
      echo finishing up
  