aboutsummaryrefslogtreecommitdiffstats
path: root/src/Plugin
diff options
context:
space:
mode:
authorTeddy Wing2017-07-30 19:36:28 +0200
committerTeddy Wing2017-07-30 19:36:28 +0200
commite4b00259ec4c1338f766561aba3b7a3a3159d216 (patch)
tree8ea8a29c3de9268d114041fc636354b1b8820ea7 /src/Plugin
parent487f8f805647d3f3fbb86aac6838f0c0e37a6bde (diff)
downloadsorbot-e4b00259ec4c1338f766561aba3b7a3a3159d216.tar.bz2
Move `Plugin` and `PluginAction` to a new module
Move our base plugin types to a new module to enable us to use them in both the plugin matching code (which we'll leave in "Plugin.hs") and in specialised plugin modules. This enables us to import and provide a list of plugins in `plugins` in "Plugin.hs" and use these types in that file and in the plugin files without any circular/recursive module dependencies.
Diffstat (limited to 'src/Plugin')
-rw-r--r--src/Plugin/Base.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Plugin/Base.hs b/src/Plugin/Base.hs
new file mode 100644
index 0000000..c73ef6a
--- /dev/null
+++ b/src/Plugin/Base.hs
@@ -0,0 +1,17 @@
+module Plugin.Base
+ ( PluginAction
+
+ , Plugin(..)
+ , matchRegex
+ , perform
+ ) where
+
+type PluginAction = String -> String
+
+data Plugin = Plugin
+ { matchRegex :: String
+ , perform :: PluginAction
+ }
+
+instance Show Plugin where
+ show (Plugin r p) = "matchRegex = " ++ r