[GHC] #9453: The example for GHC Generics is kinda broken

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 7.8.2 Keywords: | Operating System: Architecture: Unknown/Multiple | Unknown/Multiple Difficulty: Unknown | Type of failure: Blocked By: | None/Unknown Related Tickets: | Test Case: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- From http://www.reddit.com/r/haskell/comments/2douzn/problem_with_popular_ghcgene...: The popular GHC.Generics serialization example at http://www.haskell.org/ghc/docs/latest/html/users_guide/generic- programming.html#idp25226064 illustrates how to serialize a sum datatype (a :+: b), with a 0 bit representing a and a 1 bit representing b. However, consider a :+: b :+: c. If the compiler treats this as (a :+: b) :+: c, then a is 00, b is 01, c is 1. If it's a :+: (b :+: c), then a is 0, b is 10, c is 11. The compiler's decision, even though (as I understand it) consistent for any given compile, could differ later. The manual, at http://hackage.haskell.org/package/generic- deriving-1.6.3/docs/Generics-Deriving-Base.html#g:9 states not to depend on the ordering, which the example does. I think this is a valid concern, and the manual should be at least updated to discuss this problem. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: dreixel Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.8.2 Documentation | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: => dreixel Comment: Assigning to Pedro: would you care to comment/fix? Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: dreixel Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.8.2 Documentation | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dreixel): Yes; certainly if the way the compiler nests sums in the automatic derivation of `Generic` instances changes, or if the user is giving their own instances, there is no guarantee that the serialisation outcome is the same. I could perhaps add a note to the example in the manual to highlight the fact that it doesn't try to work across different versions of the compiler. Updating the example to deal with different nestings would be overkill, I think. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: dreixel Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: | Version: 7.8.2 Documentation | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: Documentation bug | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * failure: None/Unknown => Documentation bug * milestone: => 7.10.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: dreixel Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Documentation | Version: 7.8.2 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => Generics -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: dreixel Type: bug | Status: patch Priority: normal | Milestone: Component: Documentation | Version: 7.8.2 Resolution: | Keywords: Generics Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3782 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D3782 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9453: The example for GHC Generics is kinda broken
-------------------------------------+-------------------------------------
Reporter: Feuerbach | Owner: dreixel
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Documentation | Version: 7.8.2
Resolution: | Keywords: Generics
Operating System: Unknown/Multiple | Architecture:
Type of failure: Documentation | Unknown/Multiple
bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3782
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#9453: The example for GHC Generics is kinda broken -------------------------------------+------------------------------------- Reporter: Feuerbach | Owner: dreixel Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Documentation | Version: 7.8.2 Resolution: fixed | Keywords: Generics Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3782 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: patch => closed * resolution: => fixed * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9453#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC