Enable --hyperlink-source for “cabal install”

前端 未结 3 2021
借酒劲吻你
借酒劲吻你 2020-12-31 00:47

The command cabal haddock has very useful --hyperlink-source option. I would like to have the source hyperlinked when building documentation with cabal in

3条回答
  •  孤独总比滥情好
    2020-12-31 01:21

    For me this worked:

    cabal update
    cabal install haddock
    

    Edit config file ~/.cabal/config

    Enable Documentation: True (removing "-- " at the beginning of the line is fine)


    Cabal Library:

    cd ...someNicePlace...    
    
    cabal unpack Cabal
    

    Edit file Distribution/Simple/Setup.hs, therein find defaultHaddockFlags = ...

    I switched some of them from False to True:

    ... 
    haddockHoogle       = Flag True,
    ...
    haddockHtml         = Flag True,
    ...
    haddockExecutables  = Flag True,
    ...
    haddockHscolour     = Flag True,
    ...
    

    having haddockHscolour the only important one (don't have to change the others if not want to).

    Install updated Cabal Library:

    sudo cabal install --global
    

    cabal-install (cabal shell command)

    To get the updated Cabal Libary working within cabal shell command, I reinstalled cabal-install also:

    cd ...someNicePlace...    
    
    cabal unpack cabal-install
    
    sudo cabal install --global
    

    Since then the shell command cabal --version says to me:

    cabal-install version 1.16.0.2 
    using version 1.16.0.3 of the Cabal library 
    

    And, as wanted, any new cabal install is now installing full haddock html documentation with source codes hyperlinked as default.

提交回复
热议问题