
#14004: G -------------------------------------+------------------------------------- Reporter: zaoqi | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by zaoqi): Replying to [comment:11 AntC]:
Replying to [comment:10 zaoqi]:
Good. You've got it to compile. So we can close the ticket.
I apologise: my comment:9 is wrong. I must have confused myself playing with it. Ben is right:
... it's not even possible to know at runtime whether the bound `a` and `b` values are of the same type.
In fact variables `a`, `b` bound by GADT `Dyn` are "rigid type variables". GHC always treats them as different types. They're existentially quantified. See [http://downloads.haskell.org/~ghc/8.0.2/docs/html/users_guide/glasgow_exts.h... #generalised-algebraic-data-types-gadts The User Guide on GADTs]
So `instance Eq Dyn` will always return False.
How to write the correct `instance Eq Dyn`, do not change `data Dyn`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14004#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler