[Haskell-cafe] Concept for "equal but unknown"

martin martin.drautzburg at web.de
Fri Oct 2 07:23:25 UTC 2015


Hello all,

there is a problem which popped up a number of times recently and I wondered if there is a general concept to tackle
this kind of problems. It goes like this:

I book a hotel room. At this time it becomes known that the hotel has one fewer room available, but it is not known
which room it is. Likewise I know, that I have a reservation for "a room", but I don't know which one it is. It is
however known, that the room in my reservation is the same room the hotel has removed from the list of available rooms.

Another example: In air-cargo the cargo company has reserverd space in an aircraft for two containers. One for
high-priority parcels and one for low-priority parcels. In the cargo hub, they plan to pack these two containers. At
this point in time it is only known that there will be two containers one labelled "high-prio" and the other labelled
"low-prio" but their physical identity is not known. Only when you actually do the packing you have a physical container
at hand, which has identity. At this moment it becomes clear to which physical containers the reservations refer to and
which physical containers are used for packing.

I think I can handle this in an imparative style using an extra indirection (think pointers), though even there I would
be happy if someone told me something like "this is an example of covariant unification" or something like this. But in
haskell I cannot see a solution at all?

So:

how can I express that two things are equal to each other without knowing the exact value and

how do I manage to make both assume a value once one of them becomes known.

Do these kind of problems have a name?


More information about the Haskell-Cafe mailing list