[Haskell-cafe] Re: aggressiveness of functional dependencies

Nicolas Frisby nicolas.frisby at gmail.com
Fri Nov 10 23:35:21 EST 2006


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, apfelmus at quantentunnel.de <apfelmus at quantentunnel.de> 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
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list