aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sorbot.cabal1
-rw-r--r--src/Plugin.hs13
-rw-r--r--src/Plugin/Base.hs17
3 files changed, 20 insertions, 11 deletions
diff --git a/sorbot.cabal b/sorbot.cabal
index 49c21fa..a581bea 100644
--- a/sorbot.cabal
+++ b/sorbot.cabal
@@ -17,6 +17,7 @@ library
hs-source-dirs: src
exposed-modules: Lib
, Plugin
+ , Plugin.Base
build-depends: base >= 4.7 && < 5
, regex-tdfa
default-language: Haskell2010
diff --git a/src/Plugin.hs b/src/Plugin.hs
index 6522e0b..41b0296 100644
--- a/src/Plugin.hs
+++ b/src/Plugin.hs
@@ -1,21 +1,12 @@
module Plugin
- ( Plugin
- , matchPlugin
+ ( matchPlugin
, performPlugin
, plugins
) where
import Text.Regex.TDFA
-type PluginAction = String -> String
-
-data Plugin = Plugin
- { matchRegex :: String
- , perform :: PluginAction
- }
-
-instance Show Plugin where
- show (Plugin r p) = "matchRegex = " ++ r
+import Plugin.Base
matchPlugin :: String -> Maybe Plugin
matchPlugin message = firstPlugin $ matchPlugins message plugins
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