diff options
author | Ron Mordechai <ronmrdechai@gmail.com> | 2019-08-18 19:22:01 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-09-27 22:11:06 -0400 |
commit | 9c02a793be61a66bc091729f50e567096ab74a5c (patch) | |
tree | 5bc3d9ae128c27a730def0eb9d46026e9d828b59 /docs/users_guide/using.rst | |
parent | 289fc8da2a29dab8282538a0ddc5db7617cdca5b (diff) | |
download | haskell-9c02a793be61a66bc091729f50e567096ab74a5c.tar.gz |
Allow users to disable Unicode with an env var
Unicode renders funny on my terminal and I like to avoid it where
possible. Most applications which print out non-ascii characters allow
users to disable such prints with an environment variable (e.g.
Homebrew).
This diff disables Unicode usage when the environment variable
`GHC_NO_UNICODE` is set. To test, set the env var and compile a bad
program. Note that GHC does not print Unicode bullets but instead prints
out asterisks:
```
$ GHC_NO_UNICODE= _build/stage1/bin/ghc ../Temp.hs
[1 of 1] Compiling Temp ( ../Temp.hs, ../Temp.o )
../Temp.hs:4:23: error:
* Couldn't match type `Bool' with `a -> Bool'
Expected type: Bool -> a -> Bool
Actual type: Bool -> Bool
* In the first argument of `foldl', namely `(&& (flip $ elem u))'
In the expression: foldl (&& (flip $ elem u)) True v
In an equation for `isPermut':
isPermut u v = foldl (&& (flip $ elem u)) True v
* Relevant bindings include
v :: [a] (bound at ../Temp.hs:4:12)
u :: [a] (bound at ../Temp.hs:4:10)
isPermut :: [a] -> [a] -> Bool (bound at ../Temp.hs:4:1)
|
4 | isPermut u v = foldl (&& (flip $ elem u)) True v
| ^^^^^^^^^^^^^^^^^^
```
(Broken code taken from Stack Overflow)
Diffstat (limited to 'docs/users_guide/using.rst')
-rw-r--r-- | docs/users_guide/using.rst | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/docs/users_guide/using.rst b/docs/users_guide/using.rst index 8462a87cd8..d97e3bd2e8 100644 --- a/docs/users_guide/using.rst +++ b/docs/users_guide/using.rst @@ -1153,3 +1153,14 @@ Some flags only make sense for a particular use case. included. This option can be used to specify the path to the ``ghcversions.h`` file to be included. This is primarily intended to be used by GHC's build system. + +Other environment variables +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. index:: + single: environment variables + +GHC can also be configured using environment variables. Currently the only +variable it supports is ``GHC_NO_UNICODE``, which, when set, disables Unicode +output regardless of locale settings. ``GHC_NO_UNICODE`` can be set to anything ++(event an empty string) to trigger this behaviour. |