summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GF/Infra/Option.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/GF/Infra/Option.hs b/src/GF/Infra/Option.hs
index 380cb3af7..f992d4f98 100644
--- a/src/GF/Infra/Option.hs
+++ b/src/GF/Infra/Option.hs
@@ -77,7 +77,7 @@ data Phase = Preproc | Convert | Compile | Link
deriving (Show,Eq,Ord)
data Encoding = UTF_8 | ISO_8859_1 | CP_1251
- deriving (Show,Eq,Ord)
+ deriving (Eq,Ord)
data OutputFormat = FmtPGF
| FmtJavaScript
@@ -186,11 +186,10 @@ moduleOptionsGFO :: ModuleOptions -> [(String,String)]
moduleOptionsGFO (ModuleOptions o) =
maybe [] (\x -> [("language",x)]) (optSpeechLanguage mfs)
++ maybe [] (\x -> [("startcat",x)]) (optStartCat mfs)
--- ++ maybe [] (\x -> [("coding", e2s x)]) (Just (optEncoding mfs))
+ ++ [("coding", show (optEncoding mfs))]
++ (if optErasing mfs then [("erasing","on")] else [])
where
mfs = o defaultModuleFlags
- e2s e = maybe [] id $ lookup e [(s,e) | (e,s) <- encodings]
-- Option manipulation
@@ -475,6 +474,9 @@ encodings =
("latin1", ISO_8859_1)
]
+instance Show Encoding where
+ show = lookupShow encodings
+
lookupShow :: Eq a => [(String,a)] -> a -> String
lookupShow xs z = fromMaybe "lookupShow" $ lookup z [(y,x) | (x,y) <- xs]