On Sun, Jul 25, 2010 at 1:53 PM, Alexey Karakulov <ankaraku...@gmail.com> wrote: > Suppose I have one piece of code like this: > >> class Result r e | r -> e where >> failure :: e -> r a >> success :: a -> r a > > Maybe instance is discarding failure information: > >> instance Result Maybe e where >> failure _ = Nothing >> success x = Just x
I would argue that this shouldn't successfully compile. Your class declaration claims that given r, you can uniquely determine e. But you've effectively defined instance Result Maybe () instance Result Maybe Int ... many more instances ... which means that isn't the case. I wonder if there is a potential type safety failure in the compiler with instances of this form? -- ryan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe