diff options
| author | Teddy Wing | 2017-07-30 19:48:31 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-07-30 19:48:31 +0200 | 
| commit | a96f5a87746536a045a0a9fd07f65072d680589a (patch) | |
| tree | 791558f19e211064e2cf50726d4c15b99bcb1d36 | |
| parent | 459ede29282b268d60a3ef73a54098df81816b60 (diff) | |
| download | sorbot-a96f5a87746536a045a0a9fd07f65072d680589a.tar.bz2 | |
Plugin.hs: Add some minimal documentation
Write some short documentation above the function definitions to remind
myself later about what they're supposed to do.
| -rw-r--r-- | src/Plugin.hs | 4 | 
1 files changed, 4 insertions, 0 deletions
| diff --git a/src/Plugin.hs b/src/Plugin.hs index da38943..84b4779 100644 --- a/src/Plugin.hs +++ b/src/Plugin.hs @@ -9,18 +9,22 @@ import Text.Regex.TDFA  import Plugin.Base  import Plugin.GitHubCommit +-- | Get the first plugin that matches the given message text.  matchPlugin :: String -> Maybe Plugin  matchPlugin message = firstPlugin $ matchPlugins message plugins    where      firstPlugin []     = Nothing      firstPlugin (p:ps) = Just p +-- | Filter the list of plugins to those that match the given message.  matchPlugins :: String -> [Plugin] -> [Plugin]  matchPlugins message plugins = [p | p <- plugins, message =~ matchRegex p] +-- | Run the action belonging to the plugin, stored in its `perform` field.  performPlugin :: Plugin -> String -> String  performPlugin p message = perform p $ message =~ matchRegex p +-- | The list of plugins to load  plugins :: [Plugin]  plugins =      [ gitHubCommit | 
