Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to describe function parameters first in Haddock?

Typical Haddock syntax allow to write something like this

-- Initializes local variables so arrays will get defined
--
-- Defer initialization context inside a compound type.
-- 
initialize :: Bool      -- ^ 1st parameter description  
           -> Type      -- ^ 2nd parameter description
           -> [Signal]  -- ^ 3rd parameter description
           -> Structure -- ^ 4th parameter description
           -> Doc       -- ^ result value desription
initialize _ (MachineVector 1 Pointer{}) = equals <+> text "NULL"

I want to write it in Java manner, where I have parameters description before function signature. I have more complex signatures, so this approach breaks readability. Is there any way to write like this?

-- Initializes local variables so arrays will get defined
--
-- Defer initialization context inside a compound type.
-- 
-- ^ 1st parameter description
-- ^ 2nd parameter description
-- ^ 3rd parameter description
-- ^ 4th parameter description
-- ^ result value desription
initialize :: Bool->Type->[Signal]->Structure->Doc       
initialize _ (MachineVector 1 Pointer{}) = equals <+> text "NULL"
like image 640
sigrlami Avatar asked Dec 08 '14 21:12

sigrlami


People also ask

Where do parameters go in the definition of a function?

The terms parameter and argument can be used for the same thing: information that are passed into a function. From a function's perspective: A parameter is the variable listed inside the parentheses in the function definition. An argument is the value that are sent to the function when it is called.

What are the parameters of a function called?

Nevertheless, parameters are local variables defined in the function (inside of parentheses in the function header) and used to hold the data passed into the function.

What is haddock documentation?

Haddock is a free, portable command-line program documentation generator for Haskell. It is influenced by IDoc, HDoc, and Doxygen.


1 Answers

Looking through the Haddock source code, it looks like no, as function arguments are only extracted from inside types.

like image 77
rampion Avatar answered Oct 01 '22 12:10

rampion