[Haskell-cafe] Re: Re: Data.Ring -- Pre-announce
uzytkownik2 at gmail.com
Mon Jan 4 15:13:23 EST 2010
On Mon, 2010-01-04 at 07:17 -0700, Luke Palmer wrote:
> On Mon, Jan 4, 2010 at 6:51 AM, Maciej Piechotka <uzytkownik2 at gmail.com> wrote:
> > About comonad - not exactly as every comonad is copointed and the only
> > possible way is extract Empty = _|_
> I think this module could be cleaned up by disallowing empty lists.
> You have this nice semantic property that "every clist has a focus",
> but when you add empty you have to add "unless it's empty". focus
> returns a Maybe, isEmpty is necessary.
> I mean, it could be that your use case requires empty clists and would
> be uglier without empty, but think about it. I find in Haskell that
> simplicity breeds simplicity; i.e. I'm willing to wager that whatever
> algorithm you are using clist for will actually be cleaner if you got
> rid of empty and modify the algorithm accordingly. We shall see
However then we lost the monoid (ok. I haven't send patch but please
accept) along with alternative/monad plus - which is much more
popular, standard and useful then Copointed/Comonad.
Additionally it would introduce:
fromList  = _|_
Is is somehow similar to 0 \in N - sometimes it is better to include it
sometimes to not include it.
> instance Monoid CList where
> mempty = Empry
> mappend = mplus
More information about the Haskell-Cafe