Control.Monad proposal: Add whenJust

amindfv at gmail.com amindfv at gmail.com
Thu May 16 19:09:42 CEST 2013


IMO this is 100% "Polymorphism: You're Doing It Wrong."

I +1 edwardk's suggestion of updating the prelude, but couldn't "classy prelude"-style drop-ins allow the same?

Tom


El May 16, 2013, a las 3:44 AM, Andreas Abel <andreas.abel at ifi.lmu.de> escribió:

> +1.
> 
> Currently something is broken since in the presence of
> 
>  import Data.Traversable (mapM)
> 
> the rest of the import list looks like this:
> 
>  import Prelude hiding (mapM)
>  import Control.Monad.Identity hiding (mapM)
>  import Control.Monad.State hiding (mapM)
>  import Control.Monad.Error hiding (mapM)
>  import Control.Monad.Reader hiding (mapM)
> 
> I don't know why all these modules export a mapM that only works for lists, rather than the generic mapM from Traversable.
> 
> --Andreas
> 
> On 16.05.13 9:22 AM, Ganesh Sittampalam wrote:
>> -1 for the reasons given by Henning.
>> 
>> Also more polymorphic types generally cause worse error messages.
>> 
>> On 15/05/2013 17:14, Edward Kmett wrote:
>>> Personally, I'd be all for just moving Foldable (and Traversable) into
>>> the Prelude and retiring the monomorphic versions of the functions they
>>> supply. Both abstractions have born the test of time, and its hard to
>>> even envision Haskell without them at this point.
>>> 
>>> I'm somewhat leery that we coud get this proposal past the "but it makes
>>> it harder to introduce people to Haskell" backlash, but I'd
>>> wholeheartedly support it.
>>> 
>>> -Edward
>>> 
>>> 
>>> On Wed, May 15, 2013 at 10:25 AM, Ben Millwood <haskell at benmachine.co.uk
>>> <mailto:haskell at benmachine.co.uk>> wrote:
>>> 
>>>     On Wed, May 15, 2013 at 08:01:52AM +0300, Roman Cheplyaka wrote:
>>> 
>>>         * Ben Millwood <haskell at benmachine.co.uk
>>>         <mailto:haskell at benmachine.co.uk>> [2013-05-12 10:11:01+0100]
>>> 
>>>             You can mostly minimise harm by only hiding specific things, but
>>>             that's still more effort than I feel like I should have to
>>>             go to. I
>>>             think if we decide that the Foldable approach is useful
>>>             enough to go
>>>             in base, we should not make it a second-class citizen.
>>> 
>>> 
>>>         ... except it is in base already :)
>>> 
>>>         Roman
>>> 
>>> 
>>>     Yeah, sorry, to clarify: *since* we think it is important enough to
>>>     go in base, we should make it easy to use as well.
> 
> -- 
> Andreas Abel  <><      Du bist der geliebte Mensch.
> 
> Theoretical Computer Science, University of Munich
> Oettingenstr. 67, D-80538 Munich, GERMANY
> 
> andreas.abel at ifi.lmu.de
> http://www2.tcs.ifi.lmu.de/~abel/
> 
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list