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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe