ixset, , " " "", Indexable , , , . ( , empty , empty !). , , ( ):
data IxFun a = forall key. (Typeable key, Ord key) => IxFun (a -> [key])
ixFun' :: (Typeable key, Ord key) => (a -> [key]) -> IxFun a
ixFun' = IxFun
instance Contravariant IxFun where
contramap f (IxFun g) = IxFun (g . f)
ixFromIxFun :: IxFun a -> Ix a
ixFromIxFun (IxFun f) = ixFun f
, :
class IndexableFun a where funs :: [IxFun a]
-- turn any IndexableFun into an Indexable
defaultEmpty :: IndexableFun a => IxSet a
defaultEmpty = ixSet (map ixFromIxFun funs)
Indexable, empty = ixSet [ixFun foo, ...] funs = [ixFun' foo, ...]. :
instance (IndexableFun a, Typeable a) => IndexableFun (Keyed a) where
funs = ixFun' (\v -> [key v]) : map (contramap value) funs
instance (IndexableFun a, Typeable a) => Indexable (Keyed a) where
empty = defaultEmpty
ixGen :
ixGen' :: forall proxy a b. (Data a, Ord b, Typeable b) => proxy b -> IxFun a
ixGen' _ = ixFun' (flatten :: a -> [b])
ixset . , : , -, Indexable, - -, , .