First off, thanks for the reply.
I am accustomed to GHC ignoring instance contexts as you mentioned.
It's the "mostly" part that I'm curious about: mostly implies there's
some phases that don't ignore context. Is that only the checking the
type of the method definitions and absolutely nothing else? So it
seems...
My project is rather committed to GHC, but could you elaborate on your
reference to Hugs being different?
Thanks again,
Nick
On 11/9/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Nicolas Frisby wrote:
>> > The inferred type for rite_t1 is
>> > rite_t1 :: (Iso (Either Char a) (Either f' g')) => () -> Either f' g'
>> >
>> > Why isn't the inferred type of rite_t1 the same as the ascribed type
>> > of rite_t1'?
>> >
>> > > rite_t1' :: Iso b b' => () -> Either MyChar b'
>> > > rite_t1' () = rite t1
I think GHC does not know whether the given instance declaration
instance ... => Iso (Either a b) (Either a' b')
even applies to the special case of (a = Char) because it mostly ignores
the preconditions on the left side of (=>). Hugs is much different.
Maybe throwing away undecidable instances will drastically change things.
> Last post until a response I promise! Another demonstration:
>
> bar () = runIdentity . flip runStateT 0 $ return 'c'
>
> Inferred signature:
> bar :: (Monad (StateT s Identity), Num s) => () -> (Char, s)
>
> Why not?
> bar :: Num s => () -> (Char, s)
>
> I am not coming up with an s that could prevent (StateT s Identity)
> from being a monad. Is there one?
The same might go on for this case. By not looking at the preconditions
in the instance declaration
instance Monad m => Monad (StateT s m)
GHC concludes that (Monad (StateT s Identity)) might or might not hold
depending on s.
Regards,
apfelmus
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe