aboutsummaryrefslogtreecommitdiffstats
path: root/src/PluginList.hs
diff options
context:
space:
mode:
authorTeddy Wing2017-08-20 12:42:28 +0200
committerTeddy Wing2017-08-20 15:11:52 +0200
commite94543c1b42bac8928aa8bf4fa3341563f7631b8 (patch)
tree0cb05e9e02b85f7031884c60ccc23a4e05e37049 /src/PluginList.hs
parent5aecb2aede18f285a9cce3a0fb066a1911814a17 (diff)
downloadsorbot-e94543c1b42bac8928aa8bf4fa3341563f7631b8.tar.bz2
Add Factorial plugin
This plugin calculates factorials. It's not super optimised, but works for small inputs. Adds the 'text-show' plugin to convert the resulting integer to a `Data.Text` to be returned by the plugin action. At first I had tried /^\d+!$/ for the regex match, but that produced this error: sorbot/src/Plugin/Factorial.hs:14:24: error: lexical error in string/character literal at character 'd' Tried to fix that by using /^\\d+!$/, but that didn't match anything. Then tried a long-form character class, /^[:digit:]+!$/, which TDFA implies it supports, but a quick look at the code seems to indicate that those parts were removed or commented out. Not sure what was going on with that. So instead went for the remaining solution, a `0-9` character class.
Diffstat (limited to 'src/PluginList.hs')
-rw-r--r--src/PluginList.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/PluginList.hs b/src/PluginList.hs
index bfcae7e..7c950c0 100644
--- a/src/PluginList.hs
+++ b/src/PluginList.hs
@@ -3,6 +3,7 @@ module PluginList
) where
import Plugin.Base (Plugin)
+import Plugin.Factorial
import Plugin.GitHubCommit
import Plugin.GitRemoteSetOrigin
@@ -10,6 +11,7 @@ import Plugin.GitRemoteSetOrigin
-- cause a circular import.
plugins :: [Plugin]
plugins =
- [ gitHubCommit
+ [ factorial
+ , gitHubCommit
, gitRemoteSetOrigin
]