GHC issues
https://gitlab.haskell.org/ghc/ghc/-/issues
2019-07-07T18:15:01Z
https://gitlab.haskell.org/ghc/ghc/-/issues/14925
Non-ASCII type names get garbled when their `TypeRep` is shown
2019-07-07T18:15:01Z
leftaroundabout
Non-ASCII type names get garbled when their `TypeRep` is shown
[Typeable](http://hackage.haskell.org/package/base-4.10.1.0/docs/Data-Typeable.html) allows easily showing the name of a type by, well, using `show` on it. However, this does not work right for types with Unicode symbols in their name:
...
[Typeable](http://hackage.haskell.org/package/base-4.10.1.0/docs/Data-Typeable.html) allows easily showing the name of a type by, well, using `show` on it. However, this does not work right for types with Unicode symbols in their name:
```
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Prelude> :m +Data.Typeable
Prelude Data.Typeable> data W = W
Prelude Data.Typeable> typeOf W
W
Prelude Data.Typeable> data Ω = Ω
Prelude Data.Typeable> typeOf Ω
Ω
```
This did not yet happen in GHC-7:
```
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
Prelude> :m +Data.Typeable
Prelude Data.Typeable> data W = W
Prelude Data.Typeable> typeOf W
W
Prelude Data.Typeable> data Ω = Ω
Prelude Data.Typeable> typeOf Ω
Ω
```
N.b.:
```
Prelude> import Data.ByteString.Char8 as BC8
Prelude BC8> BC8.putStrLn $ pack "Ω"
Ω
```
So, this appears to be a UTF-8 problem – something interprets bytestring-stored type-representation names as a different character encoding.
<details><summary>Trac metadata</summary>
| Trac field | Value |
| ---------------------- | -------------- |
| Version | 8.2.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | |
</details>
<!-- {"blocked_by":[],"summary":"Non-ASCII type names get garbled when their `TypeRep` is shown","status":"New","operating_system":"","component":"libraries/base","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.2.1","keywords":["ASCII","TypeRep","Typeable","UTF-8","Unicode"],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"[http://hackage.haskell.org/package/base-4.10.1.0/docs/Data-Typeable.html Typeable] allows easily showing the name of a type by, well, using `show` on it. However, this does not work right for types with Unicode symbols in their name:\r\n{{{\r\nGHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :m +Data.Typeable\r\nPrelude Data.Typeable> data W = W\r\nPrelude Data.Typeable> typeOf W\r\nW\r\nPrelude Data.Typeable> data Ω = Ω\r\nPrelude Data.Typeable> typeOf Ω\r\nΩ\r\n}}}\r\nThis did not yet happen in GHC-7:\r\n{{{\r\nGHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help\r\nPrelude> :m +Data.Typeable\r\nPrelude Data.Typeable> data W = W\r\nPrelude Data.Typeable> typeOf W\r\nW\r\nPrelude Data.Typeable> data Ω = Ω\r\nPrelude Data.Typeable> typeOf Ω\r\nΩ\r\n}}}\r\nN.b.:\r\n{{{\r\nPrelude> import Data.ByteString.Char8 as BC8\r\nPrelude BC8> BC8.putStrLn $ pack \"Ω\"\r\nΩ\r\n}}}\r\nSo, this appears to be a UTF-8 problem – something interprets bytestring-stored type-representation names as a different character encoding.","type_of_failure":"OtherFailure","blocking":[]} -->
8.4.2