Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to document type-class constraints using Haddock?

I'm trying to document some very scary type-class constraints and explaining why they're required, but I can't seem to get the following working in Haddock:

{-|

This will show-up at the top of the module

-}

module Try where

-- | This shows up immediately after the class "header"
class (

    -- | PROBLEM: This doesn't work...
    Show a -- ^ PROBLEM: Also, this doesn't work

    ) => Something a where

    -- | This shows up as the method's documentation
    something :: a -> Int
like image 733
Saurabh Nanda Avatar asked Jul 21 '26 19:07

Saurabh Nanda


1 Answers

There isn't any way to make this work with the latest version of Haddock.

This idea has been brought up before in passing: https://github.com/haskell/haddock/issues/472#issuecomment-257136046. I wouldn't hold my breath though - this would require some really core changes to how Haddock stores doc strings.

like image 73
Alec Avatar answered Jul 24 '26 15:07

Alec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!