Skip to content

Instantly share code, notes, and snippets.

@kozross
Created November 8, 2018 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kozross/a2862aee7bdae17632aa268b7586dc94 to your computer and use it in GitHub Desktop.
Save kozross/a2862aee7bdae17632aa268b7586dc94 to your computer and use it in GitHub Desktop.
-- Suppose these are the mappings:
mappingsAsList :: [((Int,Int), Bool)]
mappingsAsList [((1,2), True), ((1,3), False), ((1,4), True),
((2,4), True), ((2,5), False), ((2,6), True)]
-- I wanna be able to efficiently request 'give me all mappings where the first part of the key is x'.
-- For instance, if I asked for x = 1, I should get [((1,2), True), ((1,3), False), ((1,4), True)]
-- I also wanna be able to efficiently request 'give me all mappings where the second part of the key is y'.
-- For instance, if I asked for y = 4, I should get [((1,4), True), ((2,4), True)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment