Skip to content

Support Haddock for function arguments #62

Closed
@mruegenberg

Description

@mruegenberg

Often, the argument names in C headers serve as partial documentation.

Since Haskell function types lack names for arguments, it would be helpful if Haddocks in #fun definitions were put into the generated Haskell code.


An example C function:

`void foo(int width, int height);`

with the corresponding .chs:

{#fun foo
    { `Int' -- ^ width
    , `Int' -- ^ height
    } -> `()' #}

This should generate code like this:

foo :: (Int) -- ^ width
    -> (Int) -- ^ height 
    -> IO ()
foo a1 a2 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  foo'_ a1' a2' >>= \res ->
  return ()

However, the current version of C2Hs (0.16.5 in my case) ignores the Haddocks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions