Skip to content

Commit

Permalink
wip on types tables
Browse files Browse the repository at this point in the history
  • Loading branch information
jefdaj committed Jan 20, 2020
1 parent 7dbaf77 commit 3a67f9f
Show file tree
Hide file tree
Showing 2 changed files with 303 additions and 306 deletions.
11 changes: 4 additions & 7 deletions Docs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,21 @@ typesTable m = if null (mTypes m) then [""] else
, "| Type | Meaning |"
, "| :-------- | :------ |"
]
-- ++ map (\f -> "| " ++ fName f ++ " | " ++ (fromMaybe "" $ fDesc f) ++ " |") (mFunctions m)
-- ++ map (\f -> "| " ++ fName f ++ " | " ++ "" ++ " |") (mFunctions m)
++ map explainType (mTypes m)
++ [""]

explainFunction :: OrthoLangFunction -> String
explainFunction = join " | " . barred . map quoted . elems
explainFunction = join " | " . map quoted . elems
where
elems f = filter (not . (`elem` [":", "->"])) $ splitOn " " $ fTypeDesc f
barred es = [head es, join ", " $ init $ tail es, last es]
elems f = splitOn ":" $ fTypeDesc f
quoted t = "`" ++ t ++ "`"

functionsTable :: OrthoLangModule -> [String]
functionsTable m = if null (mFunctions m) then [""] else
[ "Functions:"
, ""
, "| Name | Inputs | Output |"
, "| :--- | :----- | :----- |"
, "| Name | Type |"
, "| :--- | :--- |"
]
++ map (\f -> "| " ++ explainFunction f ++ " |") (mFunctions m)
++ [""]
Expand Down
Loading

0 comments on commit 3a67f9f

Please sign in to comment.