Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data EmojiCollection
- loadEmoji :: FilePath -> IO (Either String EmojiCollection)
- emptyEmojiCollection :: EmojiCollection
- getMatchingEmoji :: Session -> EmojiCollection -> Text -> IO [Text]
- matchesEmoji :: Text -> Text -> Bool
Documentation
data EmojiCollection Source #
The collection of all emoji names we loaded from a JSON disk file. You might rightly ask: why don't we use a Trie here, for efficient lookups? The answer is that we need infix lookups; prefix matches are not enough. In practice it seems not to matter that much; despite the O(n) search we get good enough performance that we aren't worried about this. If at some point this becomes an issue, other data structures with good infix lookup performance should be identified (full-text search, perhaps?).
loadEmoji :: FilePath -> IO (Either String EmojiCollection) Source #
Load an EmojiCollection from a JSON disk file.
getMatchingEmoji :: Session -> EmojiCollection -> Text -> IO [Text] Source #
Perform an emoji search against both the local EmojiCollection as well as the server's custom emoji. Return the results, sorted. If the empty string is specified, all local and all custom emoji will be included in the returned list.