matterhorn-90000.0.0: Terminal client for the Mattermost chat system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Matterhorn.Emoji

Synopsis

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.

matchesEmoji Source #

Arguments

:: Text

The search string (will be converted to lowercase and colons will be removed)

-> Text

The emoji string (assumed to be lowercase and without leading/trailing colons)

-> Bool 

Match a search string against an emoji.