[Haskell-cafe] [Haskell] ANNOUNCE: set-monad

George Giorgidze giorgidze at gmail.com
Mon Jun 18 22:54:49 CEST 2012

Hi Derek,

On 16 June 2012 21:53, Derek Elkins <derek.a.elkins at gmail.com> wrote:
> The law that ends up failing is toList .
> fromList /= id, i.e. fmap g . toList . fromList . fmap h /= fmap g .
> fmap h

This is not related to functor laws. The property that you desire is
about toList and fromList.

The toList and fromList functions are not required to satisfy  toList
. fromList /= id.

This does not hold for Data.Set and it does not hold for the
Data.Set.Monad wrapper either. Duplicates are lost when lists are
converted  into sets.

Other instances of fromList and toList also fail to satisfy the
property that you desire (e.g., Map).

Cheers, George

More information about the Haskell-Cafe mailing list