Open AshleyYakeley opened 7 years ago
Can you give an example of one of these other container types you're talking about?
On Fri, Apr 14, 2017, 2:08 AM Ashley Yakeley notifications@github.com wrote:
Currently, there's the IsMap class:
class (MonoTraversable map, SetContainer map) => IsMap map where type MapValue map lookup :: ContainerKey map -> map -> Maybe (MapValue map) insertMap :: ContainerKey map -> MapValue map -> map -> map -- etc.
In most (all?) instances of IsMap, we have Element map ~ (ContainerKey map, MapValue map), that is, there's some MapValue type that is "the element minus the key".
However, for some containers, there isn't a suitable MapValue type because the key cannot easily be removed from the Element type. Instead, we'd want a class that looks more like this:
class (MonoTraversable map, SetContainer map) => KeyContainer map where elementKey :: Element map -> ContainerKey map lookupElement :: ContainerKey map -> map -> Maybe (Element map) insertElement :: Element map -> map -> map -- etc.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/snoyberg/mono-traversable/issues/129, or mute the thread https://github.com/notifications/unsubscribe-auth/AADBB5AFjQXY7ZJzj5uWFAcHK_fNFt6sks5rvqr_gaJpZM4M9TTt .
I don't know if such types already exist, but:
Element
is ByteString
and ContainerKey
is a SHA-256 hash.Element
is a row, and ContainerKey
is the primary key.I'm sorry, but at this level of abstraction I'm having a really hard time understanding the request here.
Fair enough. Given that I don't actually know of any types in existing Haskell packages that would implement this and not IsMap
, it might not be worth it.
Currently, there's the
IsMap
class:In most (all?) instances of
IsMap
, we haveElement map ~ (ContainerKey map, MapValue map)
, that is, there's someMapValue
type that is "the element minus the key".However, for some containers, there isn't a suitable
MapValue
type because the key cannot easily be removed from theElement
type. Instead, we'd want a class that looks more like this: