Open treeowl opened 4 years ago
Would it make sense to define such as the following?:
newtype FoldableKey f a = FoldableKey (f a)
instance (TrieKey a, Foldable f) => TreeKey (FoldableKey f a) where
{- methods defined in terms of `toList` -}
@strake, no, it wouldn't. These tries need to be able to rebuild keys from their paths. I wouldn't be surprised if it were just barely possible to do it with Traversable
, but I'd be very surprised if that could be made efficient.
Let me take that back. It's probably possible to do something with Foldable
, storing the key alongside the value. It just doesn't match the rest of what goes on here.
Small arrays, at least, seem like reasonable things to use as trie keys.