[GHC] #14925: Non-ASCII type names get garbled when their `TypeRep` is shown
#14925: Non-ASCII type names get garbled when their `TypeRep` is shown -------------------------------------+------------------------------------- Reporter: | Owner: (none) leftaroundabout | Type: bug | Status: new Priority: low | Milestone: Component: | Version: 8.2.1 libraries/base | Keywords: Typeable | Operating System: Unknown/Multiple TypeRep Unicode ASCII UTF-8 | Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- [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: {{{ 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. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14925> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14925: Non-ASCII type names get garbled when their `TypeRep` is shown -------------------------------------+------------------------------------- Reporter: leftaroundabout | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: libraries/base | Version: 8.2.1 Resolution: | Keywords: Typeable | TypeRep Unicode ASCII UTF-8 Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | typecheck/T14925 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * testcase: => typecheck/T14925 Comment: Very interesting. Test added in Phab:D4512. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14925#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14925: Non-ASCII type names get garbled when their `TypeRep` is shown -------------------------------------+------------------------------------- Reporter: leftaroundabout | Owner: (none) Type: bug | Status: new Priority: low | Milestone: Component: libraries/base | Version: 8.2.1 Resolution: | Keywords: Typeable | TypeRep Unicode ASCII UTF-8 Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | typecheck/T14925 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"0703c00f7172608ee6d7ff7d422fe3755339e9bc/ghc" 0703c00/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="0703c00f7172608ee6d7ff7d422fe3755339e9bc" testsuite: Add test for #14925 Test Plan: Validate Reviewers: alpmestan Reviewed By: alpmestan Subscribers: alpmestan, leftaroundabout, rwbarton, thomie, carter GHC Trac Issues: #14925 Differential Revision: https://phabricator.haskell.org/D4512 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14925#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14925: Non-ASCII type names get garbled when their `TypeRep` is shown -------------------------------------+------------------------------------- Reporter: leftaroundabout | Owner: (none) Type: bug | Status: patch Priority: low | Milestone: 8.4.2 Component: libraries/base | Version: 8.2.1 Resolution: | Keywords: Typeable | TypeRep Unicode ASCII UTF-8 Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | typecheck/T14925 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4530 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D4530 * milestone: => 8.4.2 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14925#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14925: Non-ASCII type names get garbled when their `TypeRep` is shown -------------------------------------+------------------------------------- Reporter: leftaroundabout | Owner: (none) Type: bug | Status: patch Priority: low | Milestone: 8.4.2 Component: libraries/base | Version: 8.2.1 Resolution: | Keywords: Typeable | TypeRep Unicode ASCII UTF-8 Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | typecheck/T14925 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4530 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"20ae19fc7297dceaefde8d3443099bfd9cd1e905/ghc" 20ae19fc/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="20ae19fc7297dceaefde8d3443099bfd9cd1e905" base: Fix Unicode handling of TyCon's Show instance Test Plan: `make test TEST=T14925` Reviewers: hvr, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie, carter GHC Trac Issues: #14925 Differential Revision: https://phabricator.haskell.org/D4530 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14925#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14925: Non-ASCII type names get garbled when their `TypeRep` is shown -------------------------------------+------------------------------------- Reporter: leftaroundabout | Owner: (none) Type: bug | Status: closed Priority: low | Milestone: 8.4.2 Component: libraries/base | Version: 8.2.1 Resolution: fixed | Keywords: Typeable | TypeRep Unicode ASCII UTF-8 Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Incorrect result | Test Case: at runtime | typecheck/T14925 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4530 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Merged to `ghc-8.4`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14925#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC