
#9429: Alternative to type family Any -------------------------------------+------------------------------------- Reporter: mboes | Owner: Type: feature | Status: new request | Milestone: Priority: normal | Version: 7.9 Component: Compiler | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: | Related Tickets: 9097, 9380 None/Unknown | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by ekmett): Note: you already have multiple "MyAnys" `Any` inhabits all kinds, so `Any :: Nat -> *` is also a perfectly cromulent type it can inhabit, allowing you to use `Any 0, Any 1, Any 2`... This means having `Any` doesn't just punch a "one extra distinguishable member of every kind" sized hole in the sanity of the typesystem but rather it creates an infinite family of such holes. I abused that for a while in Hask to create 'evil' targets for compositions of functors to other kinds, etc. but the status quo comes at a terrible terrible price. We can no longer reason that a closed kind has a fixed set of inhabitants. `Bool` is currently inhabited by `True`, `False`, and `Any 'FileNotFound` as distinguishable inhabitants along with an infinite set of other such exotic beasts. This implementation strategy is also very leaky. You have to be very careful, as it is possible to subvert the use of this sort of mechanism very easily (and accidentally) in the presence of functional dependencies when you go to apply it in situations where one of the arguments is a GADT or functional dependency, argument to a class, etc. This can lead to straight up segfaults, not just local type strangeness. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9429#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler