Last active
August 29, 2015 14:05
-
-
Save cartazio/584aad55ef6dc6d21703 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class (Ord (Key table)) => OrderedKV table where | |
type Key table :: * | |
type Value table ::* | |
type Address table :: * | |
keyRange :: table -> (Key table, Key table) | |
key2Address :: table -> (Key table) -> Maybe (Address table) | |
address2Key :: table -> (Address table) -> Key Table | |
nextAddress :: table -> Address table -> Maybe (Address table) | |
nextKey :: table -> Key table -> Maybe (Address table) ->Maybe (Key table, Address table ) | |
sliceTable :: table -> (Address table, Address table) -> Maybe table | |
readTable :: table -> Address table -> Value table |
should revisit this
I can see how this abstracts the access pattern of []
and Vector
, do you think it can be adapted to work with a streaming backend like pipes
?
Btw, what is the difference between Key
and Address
?
@TranM i think my key2Address
should have been key2Value
. IN these apis, Key
IS the notion of address
pipes makes sense as a way of streaming chunks that you work on locally, but i dont think its teh interface you want for addressing individual items
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
alternatively, something like this might be better