1
0
forked from GitHub/gf-core

explanations to paradigms in synopsis

This commit is contained in:
aarne
2010-12-14 12:28:10 +00:00
parent b498e45dce
commit 924f48d8f8
2 changed files with 6 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ getApiExx xx = do
let aet = getApiExxTrees $ filter validOutput $ lines s let aet = getApiExxTrees $ filter validOutput $ lines s
aeos <- mapM readApiExxOne xx aeos <- mapM readApiExxOne xx
let aexx = mkApiExx $ ("API",aet) : aeos let aexx = mkApiExx $ ("API",aet) : aeos
putStrLn $ prApiExx aexx -- putStrLn $ prApiExx aexx
return aexx return aexx
readApiExxOne file = do readApiExxOne file = do

View File

@@ -4,7 +4,7 @@ import Char
import List import List
import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Char8 as BS
import qualified Data.Map as M import qualified Data.Map as M
import Debug.Trace ---- ---import Debug.Trace ----
type Cats = [(String,String,String)] type Cats = [(String,String,String)]
type Rules = [(String,String,String)] type Rules = [(String,String,String)]
@@ -181,18 +181,19 @@ mkTable hasEx isLatex aexx cs = inChunks chsize (\rs -> header : map (unwords .
where where
chsize = if isLatex then 40 else 1000 chsize = if isLatex then 40 else 1000
header = if hasEx then "|| Function | Type | Example ||" header = if hasEx then "|| Function | Type | Example ||"
else "|| Function | Type ||" else "|| Function | Type | Explanation ||"
row (name,typ,ex) = row (name,typ,ex) =
let ntyp = mkIdent (name ++ " : " ++ typ) in let ntyp = mkIdent (name ++ " : " ++ typ) in
if hasEx then ["|", name', "|", typ', "|", ex' ntyp, "|"] if hasEx then ["|", name', "|", typ', "|", ex' ntyp, "|"]
else ["|", name', "|", typ', "|"] else ["|", name', "|", typ', "|", expl ntyp, "|"]
where where
name' = ttf name name' = ttf name
typ' = showTyp cs typ typ' = showTyp cs typ
ex' typ = if null ex then itf (takeWhile (/='_') name) else ex' typ = if null ex then itf (takeWhile (/='_') name) else
case M.lookup typ aexx of case M.lookup typ aexx of
Just es -> mkExample es ex Just es -> mkExample es ex
_ -> trace typ $ itf ex _ -> itf ex
expl typ = if null ex then itf "-" else itf ex
-- make an example with hover-popup translations -- make an example with hover-popup translations
mkExample es ex = unwords [ mkExample es ex = unwords [