How do I document the parameters of a function inside of a record type with Haddock?

248 views Asked by At

I have a record type that contains a function. I'm trying to document the parameters to that function, but Haddock gives me a parse error. (When I actually compile the code to run it, it works fine.)

data Browserful jsval = Browserful
  {
    -- | See [EventTarget.addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)
    addEventListener    :: jsval  -- ^ The event target
                        -> String -- ^ The event to listen for, ie "click"
                        -> jsval  -- ^ The event target
                        -> IO ()  -- ^ Returns nothing
  }

And here's the error:

src\Web\Framework\Plzwrk\Browserful.hs:21:25: error:
    parse error on input `->'
   |
21 |                         -> String -- ^ The event to listen for, ie "click"
   |                         ^^

Does anyone know how to correctly document the function arguments here? Thanks!

0

There are 0 answers