[Haskell-cafe] What is the meaning of tilde ("~") symbol

Evan Laforge qdunkan at gmail.com
Sun Feb 14 17:41:31 EST 2010


On Sun, Feb 14, 2010 at 2:22 PM, Stephen Tetley
<stephen.tetley at gmail.com> wrote:
> On 14 February 2010 22:11, Evan Laforge <qdunkan at gmail.com> wrote:
>
>> There's still no consensus on typeclasses for collections, so these
>> are all separate functions.  Has anyone taken a shot at a set of
>> AT-using classes for the standard collections?
>
>
> The standard collections have different shapes depending on what they
> represent (maps, trees, lists, sequences) so considering Functor,
> Traversable, Foldable perhaps the common operations are largely
> already covered. A unifying 'collection' class might be as problematic
> as good old Num is for numbers...

But how about indexing?  It would be nice to have universal operators like

(!!) :: collection elt -> index -> elt
lookup :: index -> collection elt -> Maybe elt
member :: index -> collection elt -> Bool

That way you can have nice short names for these common operations.
Lists are very flexible but it's nothing Monoid hasn't already done
with integers and newtype wrappers, and there are plenty of others
which would be applicable (no pun intended): Map, Set, Bytestring,
Sequence.

I suppose we can get empty and concat with Monoid.  What about singleton?

The names and locations are all over the map (no really, not intended)
too, symptomatic I suppose of the fact that they all evolved
separately.


More information about the Haskell-Cafe mailing list