Simon,
Thanks for the extended response to my question about
overlapping instances.
Before my original posting, I had read a posting that included
the example with Show that you included in your response.
I believed (and still do) that my specific case is a bit different.
| To determine (SubType
On Thu, Jun 19, 2003 at 11:08:35AM -0500, Ed Komp wrote:
| type BaseType = Either Integer ( Either Bool () )
|
| type Value = (Either Double BaseType)
|
| data Foo = forall x. (SubType x BaseType) = MkFoo x
|
| test :: Foo - Value
| test (MkFoo x) = inj x
'x' is the
Dylan Thurston wrote:
On Thu, Jun 19, 2003 at 11:08:35AM -0500, Ed Komp wrote:
| type BaseType = Either Integer ( Either Bool () )
|
| type Value = (Either Double BaseType)
|
| data Foo = forall x. (SubType x BaseType) = MkFoo x
|
| test :: Foo - Value
| test
Ed Komp replied to Simon Peyton-Jones:
Within the GHC compiler
can't be instantiated to Double --- but that's tricky to pin down.
this may be tricky to pin down.
But, there is specific information in my example to exclude Double:
I had carefully constructed the type definitions to avoid
[I'm widening this to the Haskell list, because overlapping instances
are of general interest.]
| To determine (SubType y Value) which is just:
| (SubType y (Either Double BaseType))
|
| it seems to me that GHC should (has to?) use
|instance (SubType a b) = SubType a (Either x