Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b
amindfv at gmail.com
amindfv at gmail.com
Mon Apr 10 04:51:53 UTC 2017
- Previous message: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b
- Next message: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
I did see those, but was hoping people could provide real code in the context of a library or code solving a particular problem. Real world Haskell, if you will :)
Tom
> El 9 abr 2017, a las 15:33, Francesco Ariis <fa-ml at ariis.it> escribió:
>
>> On Sun, Apr 09, 2017 at 03:27:02PM -0500, amindfv at gmail.com wrote:
>> Genuinely curious: can people point to specific examples in their (or
>> others') code where the ((,) a) instance for Foldable is really helpful
>> and difficult to replace?
>
> I asked in the other thread, these are some of the answers I got:
>
> Oliver Charles:
>> Personally, I think it would be a shame to lose foldMap on EIther. I
>> frequently foldMap over Maybe values (where mempty is suitable in case of
>> "failure"), and I can certainly see myself doing the same thing with
>> Either.
>
> Oleg Grenrus:
>> Anecdotally, today I wrote `foldMap toList`, to use as `Maybe (NonEmpty
>> a) -> [a]`.
>> Also I rely heavily in lens-based code on the `folded :: Fold (Maybe a)
>> a`.
>
> There haven't been replies on specific usage of functions length/sum/
> maximum/etc.
>
> I can't recall where, but someone else was making a point that a {-# Poison
> something #-} pragma would fracture the ecosystem.
> I don't think this holds much weight though, as library authors would most
> likely toggle the flag in development (to avoid calling length Either,
> etc.) and toggle it back on release.
>
> -F
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
- Previous message: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b
- Next message: Functor, Applicative, Monad, Foldable, Traversable instances for (, , ) a b
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Libraries
mailing list