-- | Only consider tuples (key, value) where keys have the given prefix
stripFilterPrefix :: String -> [(String, a)] -> [(String, a)]
stripFilterPrefix p =
    mapMaybe choose
  where
    choose :: (String, a) -> Maybe (String, a)
    choose (k, v) =
        (,) <$> stripPrefix p k <*> pure v


-- | Get permutations of the size (n-1) for a list of n elements, alongside with
-- the element left aside.
-- Only safe on sets.
stripFilterPrefix :: String -> [(String, a)] -> [(String, a)]
stripFilterPrefix p =
    mapMaybe choose
  where
    choose :: (String, a) -> Maybe (String, a)
    choose (k, v) =
        (,) <$> stripPrefix p k <*> pure v


-- | Get permutations of the size (n-1) for a list of n elements, alongside with
-- the element left aside.
-- Only safe on sets.
stripFilterPrefix p =
    mapMaybe choose
  where
    choose :: (String, a) -> Maybe (String, a)
    choose (k, v) =
        (,) <$> stripPrefix p k <*> pure v


-- | Get permutations of the size (n-1) for a list of n elements, alongside with
-- the element left aside.
-- Only safe on sets.