On Tue, May 15, 2007 at 11:15:20AM +0100, Jules Bean wrote: > Tomasz Zielonka wrote: > >My mistake was that I forgot about db and wrote: > > > > concatStmts s1 s2 = s1 >> s2 > > > >And it was accepted because I had the Monad instance for ((->) r) in > >scope (from Control.Monad.Trans I guess)! > > The danger in overloading is that you are relying on the compiler to > infer which instance you mean. This is perhaps most visible with Monad > which has so many common instances ([], (r ->), Maybe, etc).
So it seems a good idea not to import the instances you don't want to decrease the number of typechecking combinations. Unfortunately, the way class instances are implicitly exported and imported in Haskell makes it difficult. > When writing monadic expressions in large projects, I recommend > annotating them with the types you really want. You mean I should write the type signature for concatStmts? That's a good advice, however, in my code there was no concatStmts - it would be used only in one place, so I inlined it. Best regards Tomek _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe