CurryInfo: currydoc-4.0.0 / CurryDoc.Html.genHtmlFunc

definition:
genHtmlFunc :: DocOptions -> String -> [(SourceLine,String)]
            -> [(String,[(FuncAttachment,String,[BaseHtml])])] -> AnaInfo
            -> [COpDecl] -> CFuncDecl -> BaseHtml
genHtmlFunc docopts modname progcmts funcattachments anainfo ops
            (CmtFunc _ n a vis ftype rules) =
  genHtmlFunc docopts modname progcmts funcattachments anainfo ops
              (CFunc n a vis ftype rules)
genHtmlFunc docopts modname progcmts funcattachments anainfo ops
            (CFunc (fmod,fname) _ _ ftype rules) =
  let (funcmt,paramcmts) = splitComment (getFuncComment fname progcmts)
   in anchoredDiv fname
       [borderedTable [[
         [par $
           [code [opnameDoc [showCodeHRef fname],
                  BaseText (" :: "++ showQualType docopts fmod ftype)],
            nbsp, nbsp] ++
           genFuncPropIcons anainfo (fmod,fname)] ++
         docComment2HTML docopts funcmt ++
         genParamComment paramcmts ++
         -- show contracts and properties (if present):
         showAttachments "Precondition"  PreCond  ++
         showAttachments "Postcondition" PostCond ++
         showAttachments "Specification" SpecFun  ++
         showAttachments "Properties"    Property ++
         -- show further infos for this function, if present:
         (if null furtherInfos
          then []
          else [dlist [([explainCat "Further infos:"],
                        [ulist furtherInfos])]] )]]]
 where
  showCodeHRef fn = href (modname++"_curry.html#"++fn) [htxt (showId fn)]

  showAttachments aname attachkind =
   let attachfuns = filter (\ (k,_,_) -> k==attachkind)
                           (maybe [] id (lookup fname funcattachments))
    in if null attachfuns then [] else
        [dlist [([explainCat (aname++":")],
                 [par (intercalate [breakline]
                         (map (\ (_,pn,pc) -> pc ++
                                 [nbsp, htxt "(", showCodeHRef pn, htxt ")"])
                              attachfuns))])]]

  furtherInfos = genFuncPropComments anainfo (fmod,fname) rules ops

  genParamComment paramcmts =
    let params = map (span isIdChar) (getCommentType "param" paramcmts)
        ret    = getCommentType "return" paramcmts
     in  ifNotNull params (\parCmts ->
          [ dlist [([explainCat "Example call:"],
                    [code [htxt (showCall fname (map fst params))]])
                  ]
          , dlist [([explainCat "Parameters:"],
                    [ulist (map (\ (parid,parcmt) ->
                           [code [htxt parid], htxt " : "] ++
                           removeTopPar (docComment2HTML docopts
                                                         (removeDash parcmt)))
                       parCmts)])]
          ])
      ++ ifNotNull ret (\retCmt -> [dlist (map (\rescmt ->
          ([explainCat "Returns:"],
           removeTopPar (docComment2HTML docopts rescmt))) retCmt)])

  showCall f params =
    if isAlpha (head f) || length params /= 2
    then "(" ++ showId f ++ concatMap (" "++) params ++ ")"
    else "(" ++ params!!0 ++ " " ++ f ++ " " ++ params!!1 ++ ")"
demand:
argument 7
deterministic:
deterministic operation
documentation:
-- generate HTML documentation for a function:
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,_,_,_,_,_,{CmtFunc}) |-> _ || (_,_,_,_,_,_,{CFunc}) |-> _}
name:
genHtmlFunc
precedence:
no precedence defined
result-values:
_
signature:
CurryDoc.Options.DocOptions -> String -> [(CurryDoc.Read.SourceLine, String)]
-> [(String, [(FuncAttachment, String, [HTML.Base.BaseHtml])])]
-> CurryDoc.AnaInfo.AnaInfo -> [AbstractCurry.Types.COpDecl]
-> AbstractCurry.Types.CFuncDecl -> HTML.Base.BaseHtml
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term