From 0f205f67d409e07aa1f9b95824e7a2d429130edb Mon Sep 17 00:00:00 2001 From: aarne Date: Sun, 22 Jun 2008 19:02:09 +0000 Subject: threaded string operations to strings if given as options to linearize --- src-3.0/PGF/ShowLinearize.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src-3.0/PGF') diff --git a/src-3.0/PGF/ShowLinearize.hs b/src-3.0/PGF/ShowLinearize.hs index aeb711b7a..663264d63 100644 --- a/src-3.0/PGF/ShowLinearize.hs +++ b/src-3.0/PGF/ShowLinearize.hs @@ -54,20 +54,20 @@ mkRecord typ trm = case (typ,trm) of str = realize -- show all branches, without labels and params -allLinearize :: PGF -> CId -> Tree -> String -allLinearize pgf lang = concat . map pr . tabularLinearize pgf lang where +allLinearize :: (String -> String) -> PGF -> CId -> Tree -> String +allLinearize unlex pgf lang = concat . map (unlex . pr) . tabularLinearize pgf lang where pr (p,vs) = unlines vs -- show all branches, with labels and params -tableLinearize :: PGF -> CId -> Tree -> String -tableLinearize pgf lang = unlines . map pr . tabularLinearize pgf lang where - pr (p,vs) = p +++ ":" +++ unwords (intersperse "|" vs) +tableLinearize :: (String -> String) -> PGF -> CId -> Tree -> String +tableLinearize unlex pgf lang = unlines . map pr . tabularLinearize pgf lang where + pr (p,vs) = p +++ ":" +++ unwords (intersperse "|" (map unlex vs)) -- create a table from labels+params to variants tabularLinearize :: PGF -> CId -> Tree -> [(String,[String])] tabularLinearize pgf lang = branches . recLinearize pgf lang where branches r = case r of - RR fs -> [(lab +++ b,s) | (lab,t) <- fs, (b,s) <- branches t] + RR fs -> [( b,s) | (lab,t) <- fs, (b,s) <- branches t] RT fs -> [(lab +++ b,s) | (lab,t) <- fs, (b,s) <- branches t] RFV rs -> [([], ss) | (_,ss) <- concatMap branches rs] RS s -> [([], [s])] -- cgit v1.2.3