[ TLDR: How do you do Lisp symbols in Haskell? ]

What is the Haskell approach to efficient comparison and lookup of objects by their identity?

Maybe a toy example would help to explain what I mean.

Imagine that I want to use Haskell to maximize happiness in a situation where a bunch of people have to be assigned to certain groups according to their preferences, and some constraints on the group sizes. Conceptually my input data might be structured as follows:

data Group = Group GroupName MaxGroupSize
data Person = Person Name Group Group Group

The program should partition the people into groups, attempting to get everyone into their most favoured groups.

Whatever algorithm I choose to use for the optimization, will have to do lots of comparisons of Groups and Persons where their *identity* is all that matters: you don't need to look inside the objects. On the other hand, sometimes we will have to look inside the objects, for example in order to answer queries such as "Which group did Johnny get and how far down his list of choices did that group feature?".

I should be able to run the program on data that becomes available at run time.

The lisper in me is crying out for (lisp-like-)symbols which I can create from the input data at run time and on which some extra information can be hung. How would I organize something like this in Haskell?


Thanks.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to