Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread Alejandro Serrano Mena
I'll give my two cents about some design I've been thinking about. Instead of trying to derive all instances automatically, the programmer should explicitly tell them (so the problems about conflicting implementations would be minimised). I attach a piece of code of what I think could be done:

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread James Cook
On Jul 25, 2011, at 4:55 PM, Ryan Ingram wrote: My guess is that nobody has put forward a clear enough design that solves all the problems. In particular, orphan instances are tricky. Here's an example: module Prelude where class (Functor m, Applicative m) = Monad m where return

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread Victor Nazarov
On Tue, Jul 26, 2011 at 1:01 PM, Alejandro Serrano Mena trup...@gmail.com wrote: I'll give my two cents about some design I've been thinking about. Instead of trying to derive all instances automatically, the programmer should explicitly tell them (so the problems about conflicting

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-25 Thread Ryan Ingram
My guess is that nobody has put forward a clear enough design that solves all the problems. In particular, orphan instances are tricky. Here's an example: module Prelude where class (Functor m, Applicative m) = Monad m where return :: a - m a (=) :: m a - (a - m b) - m b () :: m a

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-25 Thread Maciej Marcin Piechotka
On Mon, 2011-07-25 at 00:11 -0400, August Sodora wrote: Out of (perhaps naive) curiosity, what difficulties does allowing such overriding introduce? Wouldn't the module system prevent the ambiguity of which implementation to use? August Sodora aug...@gmail.com (201) 280-8138 class A a

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-24 Thread Sebastien Zany
I was thinking the reverse. We can already give default implementations of class operations that can be overridden by giving them explicitly when we declare instances, so why shouldn't we be able to give default implementations of operations of more general classes, which could be overridden by

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-24 Thread Ivan Lazar Miljenovic
On 25 July 2011 13:50, Sebastien Zany sebast...@chaoticresearch.com wrote: I was thinking the reverse. We can already give default implementations of class operations that can be overridden by giving them explicitly when we declare instances, so why shouldn't we be able to give default

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-24 Thread August Sodora
Out of (perhaps naive) curiosity, what difficulties does allowing such overriding introduce? Wouldn't the module system prevent the ambiguity of which implementation to use? August Sodora aug...@gmail.com (201) 280-8138 On Sun, Jul 24, 2011 at 11:55 PM, Ivan Lazar Miljenovic

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-23 Thread Sebastien Zany
Would it be theoretically possible/convenient to be able to put boilerplate like this in class definitions? On Thu, Jul 21, 2011 at 5:58 AM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Thu, Jul 21, 2011 at 8:31 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Well, for

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-23 Thread Ivan Lazar Miljenovic
On 24 July 2011 00:49, Sebastien Zany sebast...@chaoticresearch.com wrote: Would it be theoretically possible/convenient to be able to put boilerplate like this in class definitions? Not really: what happens for Functors that aren't Monads? Also, for some Monads there may be a more efficient

[Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-21 Thread Arlen Cuss
Hi cafe! I feel a bit like I'm speaking out of turn for bringing this up -- and I'm sure it must have been brought up many times before -- but I hope there can be something fruitful had from a discussion. In my travels I've read several people with much better grasp of Haskell than I have

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-21 Thread Ivan Lazar Miljenovic
On 21 July 2011 11:10, Arlen Cuss cel...@sairyx.org wrote: Hi cafe! I feel a bit like I'm speaking out of turn for bringing this up -- and I'm sure it must have been brought up many times before -- but I hope there can be something fruitful had from a discussion. In my travels I've read

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-21 Thread Felipe Almeida Lessa
On Thu, Jul 21, 2011 at 8:31 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Well, for fmap vs liftM, you have that liftM is automatically defined for you rather than needing to make the Functor instance, so if you're quickly defining a Monad for internal use then you can just use