remove Symbol type

This commit is contained in:
krasimir
2008-05-29 11:00:21 +00:00
parent a8acdd5cc5
commit ad62be0dde
2 changed files with 5 additions and 34 deletions

View File

@@ -24,25 +24,6 @@ import GF.Data.Utilities (sameLength, foldMerge, splitBy)
import GF.Infra.PrintClass
------------------------------------------------------------
-- * symbols
data Symbol c t = Cat c | Tok t
deriving (Eq, Ord, Show)
symbol :: (c -> a) -> (t -> a) -> Symbol c t -> a
symbol fc ft (Cat cat) = fc cat
symbol fc ft (Tok tok) = ft tok
mapSymbol :: (c -> d) -> (t -> u) -> Symbol c t -> Symbol d u
mapSymbol fc ft = symbol (Cat . fc) (Tok . ft)
filterCats :: [Symbol c t] -> [c]
filterCats syms = [ cat | Cat cat <- syms ]
filterToks :: [Symbol c t] -> [t]
filterToks syms = [ tok | Tok tok <- syms ]
------------------------------------------------------------
-- * edges
@@ -313,16 +294,6 @@ forest2trees (FMeta) = [TMeta]
------------------------------------------------------------
-- pretty-printing
instance (Print c, Print t) => Print (Symbol c t) where
prt = symbol prt (simpleShow . prt)
where simpleShow str = "\"" ++ concatMap mkEsc str ++ "\""
mkEsc '\\' = "\\\\"
mkEsc '\"' = "\\\""
mkEsc '\n' = "\\n"
mkEsc '\t' = "\\t"
mkEsc chr = [chr]
prtList = prtSep " "
instance Print t => Print (Input t) where
prt input = "input " ++ prt (inputEdges input)