-- | Each word has a fingerprint, but they're not all unique. Two words which
-- can be made the same by the applicaiton of some key have the same
-- fingerprint.
fingerprint :: Text.Text -> Maybe Fingerprint
fingerprint t = FP <$> Vector.foldr ((=<<) . append) (Just mempty) chars
  where
    chars = Vector.fromList (Text.unpack t)
    append c v
      | Char.isAsciiUpper c = flip Vector.cons v <$> Vector.elemIndex c chars
      | otherwise = Nothing
fingerprint :: Text.Text -> Maybe Fingerprint
fingerprint t = FP <$> Vector.foldr ((=<<) . append) (Just mempty) chars
  where
    chars = Vector.fromList (Text.unpack t)
    append c v
      | Char.isAsciiUpper c = flip Vector.cons v <$> Vector.elemIndex c chars
      | otherwise = Nothing
fingerprint t = FP <$> Vector.foldr ((=<<) . append) (Just mempty) chars
  where
    chars = Vector.fromList (Text.unpack t)
    append c v
      | Char.isAsciiUpper c = flip Vector.cons v <$> Vector.elemIndex c chars
      | otherwise = Nothing