[GHC] #12882: Unexpected constraint when using ExistentialQuantification
GHC
ghc-devs at haskell.org
Sun Nov 27 15:40:44 UTC 2016
#12882: Unexpected constraint when using ExistentialQuantification
-------------------------------------+-------------------------------------
Reporter: danilo2 | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) |
Resolution: invalid | 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 rwbarton):
But presumably the reason you want the type checker to know `t` is an
instance of `Typeable` is in order to use functions which use the
constraint, like `typeRep`. And the `Typeable t` dictionary is exactly
what will be used at runtime to implement that function. So, there is no
getting around the need for the dictionary, either passed into your
function as a constraint `Typeable t =>` or unpacked from the data as in
`tst1`.
(I'm a bit confused how you think this could work at runtime. Maybe you
are imagining that a function receives information about its type
parameters at runtime and could use that data to look up the needed
`Typeable` instance in some global table? Actually, there is no type data
at runtime aside from what you explicitly introduce in the form of
`Typeable` contexts nor any table of instances. And even `Typeable` is not
that special, and could be reimplemented to some extent by a used-defined
class.)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12882#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list