createOtherDoc ist (RecordDoc n doc ctor projs params) = do
  H.dt ! (A.id $ toValue $ show n) $ do
    H.span ! class_ "word" $ do "record"; nbsp
    H.span ! class_ "name type"
           ! title (toValue $ show n)
           $ toHtml $ name $ nsroot n
    H.span ! class_ "type" $ do nbsp ; prettyParameters
  H.dd $ do
    (if nullDocstring doc then mempty else Docstrings.renderHtml doc)
    if not $ null params
       then H.dl $ forM_ params genParam
       else mempty
    H.dl ! class_ "decls" $ createFunDoc ist ctor
    H.dl ! class_ "decls" $ forM_ projs (createFunDoc ist)
  where name (NS n ns) = show (NS (sUN $ name n) ns)
        name n         = let n' = show n
                         in if (head n') `elem` opChars
                               then '(':(n' ++ ")")
                               else n'

        genParam (name, pt, docstring) = do
          H.dt $ toHtml $ show (nsroot name)
          H.dd $ maybe nbsp Docstrings.renderHtml docstring

        prettyParameters = toHtml $ unwords [show $ nsroot n | (n,_,_) <- params]
createOtherDoc ist (RecordDoc n doc ctor projs params) = do
  H.dt ! (A.id $ toValue $ show n) $ do
    H.span ! class_ "word" $ do "record"; nbsp
    H.span ! class_ "name type"
           ! title (toValue $ show n)
           $ toHtml $ name $ nsroot n
    H.span ! class_ "type" $ do nbsp ; prettyParameters
  H.dd $ do
    (if nullDocstring doc then mempty else Docstrings.renderHtml doc)
    if not $ null params
       then H.dl $ forM_ params genParam
       else mempty
    H.dl ! class_ "decls" $ createFunDoc ist ctor
    H.dl ! class_ "decls" $ forM_ projs (createFunDoc ist)
  where name (NS n ns) = show (NS (sUN $ name n) ns)
        name n         = let n' = show n
                         in if (head n') `elem` opChars
                               then '(':(n' ++ ")")
                               else n'

        genParam (name, pt, docstring) = do
          H.dt $ toHtml $ show (nsroot name)
          H.dd $ maybe nbsp Docstrings.renderHtml docstring

        prettyParameters = toHtml $ unwords [show $ nsroot n | (n,_,_) <- params]
createOtherDoc ist (RecordDoc n doc ctor projs params) = do
  H.dt ! (A.id $ toValue $ show n) $ do
    H.span ! class_ "word" $ do "record"; nbsp
    H.span ! class_ "name type"
           ! title (toValue $ show n)
           $ toHtml $ name $ nsroot n
    H.span ! class_ "type" $ do nbsp ; prettyParameters
  H.dd $ do
    (if nullDocstring doc then mempty else Docstrings.renderHtml doc)
    if not $ null params
       then H.dl $ forM_ params genParam
       else mempty
    H.dl ! class_ "decls" $ createFunDoc ist ctor
    H.dl ! class_ "decls" $ forM_ projs (createFunDoc ist)
  where name (NS n ns) = show (NS (sUN $ name n) ns)
        name n         = let n' = show n
                         in if (head n') `elem` opChars
                               then '(':(n' ++ ")")
                               else n'

        genParam (name, pt, docstring) = do
          H.dt $ toHtml $ show (nsroot name)
          H.dd $ maybe nbsp Docstrings.renderHtml docstring

        prettyParameters = toHtml $ unwords [show $ nsroot n | (n,_,_) <- params]