Namely,
foo :: Bit -> Int -> Vector Bit -> Either Word Int
such that foo b n vec either returns the index of n-th occurence of b bit in vec or the total number of bits b in vec.
This is similar in spirit to https://hackage.haskell.org/package/text-2.1.2/docs/Data-Text.html#v:measureOff.