Program: 53050
Project: 53050
Buggy source:
@Override public <A extends Arg>BuildRule createBuildRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver resolver,A args) throws NoSuchBuildTargetException {
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  CxxPlatform cxxPlatform=cxxPlatforms.getValue(params.getBuildTarget()).or(defaultCxxPlatform);
  Linker.LinkableDepType depType=getLinkStyle(params.getBuildTarget(),args);
  BuildTarget binaryTarget=params.getBuildTarget().withFlavors(cxxPlatform.getFlavor(),ImmutableFlavor.of("String_Node_Str"));
  ImmutableList.Builder<String> linkFlagsBuilder=ImmutableList.builder();
  ImmutableList.Builder<com.facebook.buck.rules.args.Arg> linkArgsBuilder=ImmutableList.builder();
  CommandTool.Builder executableBuilder=new CommandTool.Builder();
  executableBuilder.addArg(new SourcePathArg(pathResolver,new BuildTargetSourcePath(binaryTarget)));
  if (depType == Linker.LinkableDepType.SHARED) {
    SymlinkTree sharedLibraries=resolver.addToIndex(CxxDescriptionEnhancer.createSharedLibrarySymlinkTree(params,pathResolver,cxxPlatform,params.getDeps(),Predicates.instanceOf(NativeLinkable.class)));
    Path absBinaryDir=params.getBuildTarget().getCellPath().resolve(HaskellLinkRule.getOutputDir(binaryTarget,params.getProjectFilesystem()));
    linkFlagsBuilder.addAll(MoreIterables.zipAndConcat(Iterables.cycle("String_Node_Str"),Linkers.iXlinker("String_Node_Str",String.format("String_Node_Str",cxxPlatform.getLd().resolve(resolver).origin(),absBinaryDir.relativize(sharedLibraries.getRoot()).toString()))));
    executableBuilder.addDep(sharedLibraries);
    executableBuilder.addInputs(sharedLibraries.getLinks().values());
  }
  HaskellCompileRule compileRule=resolver.addToIndex(HaskellDescriptionUtils.requireCompileRule(params,resolver,pathResolver,cxxPlatform,haskellConfig,depType,args.main,Optional.<HaskellPackageInfo>absent(),args.compilerFlags.or(ImmutableList.<String>of()),HaskellSources.from(params.getBuildTarget(),resolver,pathResolver,cxxPlatform,"String_Node_Str",args.srcs.or(SourceList.EMPTY))));
  linkArgsBuilder.addAll(SourcePathArg.from(pathResolver,compileRule.getObjects()));
  ImmutableList<String> linkFlags=linkFlagsBuilder.build();
  ImmutableList<com.facebook.buck.rules.args.Arg> linkArgs=linkArgsBuilder.build();
  final CommandTool executable=executableBuilder.build();
  final HaskellLinkRule linkRule=HaskellDescriptionUtils.createLinkRule(binaryTarget,params,resolver,pathResolver,cxxPlatform,haskellConfig,Linker.LinkType.EXECUTABLE,linkFlags,linkArgs,FluentIterable.from(params.getDeps()).filter(NativeLinkable.class),depType);
  return new BinaryWrapperRule(params,pathResolver){
    @Override public Tool getExecutableCommand(){
      return executable;
    }
    @Override public Path getPathToOutput(){
      return linkRule.getPathToOutput();
    }
  }
;
}

Fixed version (ground truth):
@Override public <A extends Arg>BuildRule createBuildRule(TargetGraph targetGraph,BuildRuleParams params,BuildRuleResolver resolver,A args) throws NoSuchBuildTargetException {
  SourcePathResolver pathResolver=new SourcePathResolver(resolver);
  CxxPlatform cxxPlatform=cxxPlatforms.getValue(params.getBuildTarget()).or(defaultCxxPlatform);
  Linker.LinkableDepType depType=getLinkStyle(params.getBuildTarget(),args);
  BuildTarget binaryTarget=params.getBuildTarget().withFlavors(cxxPlatform.getFlavor(),ImmutableFlavor.of("String_Node_Str"));
  ImmutableList.Builder<String> linkFlagsBuilder=ImmutableList.builder();
  ImmutableList.Builder<com.facebook.buck.rules.args.Arg> linkArgsBuilder=ImmutableList.builder();
  CommandTool.Builder executableBuilder=new CommandTool.Builder();
  executableBuilder.addArg(new SourcePathArg(pathResolver,new BuildTargetSourcePath(binaryTarget)));
  if (depType == Linker.LinkableDepType.SHARED) {
    SymlinkTree sharedLibraries=resolver.addToIndex(CxxDescriptionEnhancer.createSharedLibrarySymlinkTree(params,pathResolver,cxxPlatform,params.getDeps(),Predicates.instanceOf(NativeLinkable.class)));
    Path absBinaryDir=params.getBuildTarget().getCellPath().resolve(HaskellLinkRule.getOutputDir(binaryTarget,params.getProjectFilesystem()));
    linkFlagsBuilder.addAll(MoreIterables.zipAndConcat(Iterables.cycle("String_Node_Str"),Linkers.iXlinker("String_Node_Str",String.format("String_Node_Str",cxxPlatform.getLd().resolve(resolver).origin(),absBinaryDir.relativize(sharedLibraries.getRoot()).toString()))));
    executableBuilder.addDep(sharedLibraries);
    executableBuilder.addInputs(sharedLibraries.getLinks().values());
  }
  HaskellCompileRule compileRule=resolver.addToIndex(HaskellDescriptionUtils.requireCompileRule(params,resolver,pathResolver,cxxPlatform,haskellConfig,depType,args.main,Optional.<HaskellPackageInfo>absent(),args.compilerFlags.or(ImmutableList.<String>of()),HaskellSources.from(params.getBuildTarget(),resolver,pathResolver,cxxPlatform,"String_Node_Str",args.srcs.or(SourceList.EMPTY))));
  linkArgsBuilder.addAll(SourcePathArg.from(pathResolver,compileRule.getObjects()));
  ImmutableList<String> linkFlags=linkFlagsBuilder.build();
  ImmutableList<com.facebook.buck.rules.args.Arg> linkArgs=linkArgsBuilder.build();
  final CommandTool executable=executableBuilder.build();
  final HaskellLinkRule linkRule=HaskellDescriptionUtils.createLinkRule(binaryTarget,params,resolver,pathResolver,cxxPlatform,haskellConfig,Linker.LinkType.EXECUTABLE,linkFlags,linkArgs,FluentIterable.from(params.getDeps()).filter(NativeLinkable.class),depType);
  return new BinaryWrapperRule(params.appendExtraDeps(linkRule),pathResolver){
    @Override public Tool getExecutableCommand(){
      return executable;
    }
    @Override public Path getPathToOutput(){
      return linkRule.getPathToOutput();
    }
  }
;
}