-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
If the locale field LC_MESSAGES is set to a non-English language, Hint produces an GhcException.
The following demonstrates the bug. If LC_MESSAGES
is set to "C"
or "en_US.UTF-8"
, the program completes normally. Otherwise, there is an error. This program assumes that the system on which it's running supports the fr_FR
locale. A list of available locales can be obtained by running locale -a
on the command-line.
import System.Locale.SetLocale (setLocale, Category(LC_MESSAGES))
import Language.Haskell.Interpreter (InterpreterError (GhcException, NotAllowed, UnknownError, WontCompile), errMsg, runInterpreter)
main = do
-- locale <- setLocale LC_MESSAGES $ Just "C" -- This works
locale <- setLocale LC_MESSAGES $ Just "fr_FR.UTF-8" -- This fails
case locale of
Nothing -> putStrLn "Unable to set LC_MESSAGES"
Just lc_messages -> putStrLn $ "LC_MESSAGES = " ++ lc_messages
r <- runInterpreter $ return ()
case r of
Left (UnknownError msg) -> putStrLn $ "UnknownError : " ++ msg
Left (WontCompile []) -> putStrLn "WontCompile"
Left (WontCompile (err:_)) -> putStrLn $ "WontCompile : " ++ (errMsg err)
Left (NotAllowed msg) -> putStrLn $ "NotAllowed : " ++ msg
Left (GhcException msg) -> putStrLn $ "GhcException : " ++ msg
Right () -> putStrLn "Success"
Metadata
Metadata
Assignees
Labels
No labels