[Haskell-cafe] Harder than you'd think
andrewcoppin at btinternet.com
Sun Jun 13 10:16:25 EDT 2010
Philippa Cowderoy wrote:
> On 13/06/2010 14:52, Andrew Coppin wrote:
>> Marc Weber wrote:
>>>> Does anybody have a less-insane way of doing this?
>>> type MyMap = Map (KeyID, Key) Value
>>> Don't use multiple keys. Put the keys into a tuple and use that as key.
>>> Let me know whether this is what you were looking for.
>> Trouble is, this requires you to have *all* the keys to perform a
>> single lookup. You can't do a lookup on just one attribute.
> No it doesn't - think sum/or, not product/and, your tuple's (KeyID,
> Key) not (Key1, Key2, Key3...).
Oh, I see - so you enter (1, author), (2, date), (3, time), etc?
That then requires all keys to have the same type - although I think for
my needs I can put together an ADT to fix that...
More information about the Haskell-Cafe