Skip to content

ghc does not support Unicode, reports locale encoding ASCII. #64603

@kindaro

Description

@kindaro

Issue description

I installed ghc via Nix and also via Stack. With the ghc binaries provided by Stack, I can easily do Unicode IO. But the Nix ghc errors out and pretends to know nothing about Unicode.

Steps to reproduce

% ghc -e 'putStrLn "x"'
x
% ghc -e 'putStrLn "λ"'

<interactive>:0:11: error:
    lexical error in string/character literal at character '\56526'
% stack ghc -- -e 'putStrLn "λ"'
λ

% ghci
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Prelude> import System.IO
Prelude System.IO> localeEncoding  
ASCII

% stack repl
...
Configuring GHCi with the following packages: 
GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /run/user/1000/haskell-stack-ghci/2a3bbd58/ghci-script
Prelude> import System.IO
Prelude System.IO> localeEncoding 
UTF-8

% echo $LANG
en_US.UTF-8
% which stack
/home/kindaro/.nix-profile/bin/stack
% which ghci
/nix/store/67g6vwr5mx26h5mickgw17k2irdx1c0d-ghc-8.6.5/bin/ghci

Technical details

  • system: "x86_64-linux"
  • host os: Linux 5.1.16-arch1-1-ARCH, Arch Linux, noversion
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2
  • channels(kindaro): "nixpkgs-19.09pre184803.d567c486ca5"
  • nixpkgs: /home/kindaro/.nix-defexpr/channels/nixpkgs

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: haskellGeneral-purpose, statically typed, purely functional programming language
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions