summaryrefslogtreecommitdiffstats
path: root/Hirc
diff options
context:
space:
mode:
Diffstat (limited to 'Hirc')
-rw-r--r--Hirc/Parser.hs4
-rw-r--r--Hirc/Types.hs12
2 files changed, 6 insertions, 10 deletions
diff --git a/Hirc/Parser.hs b/Hirc/Parser.hs
index 2cb2451..ef34270 100644
--- a/Hirc/Parser.hs
+++ b/Hirc/Parser.hs
@@ -7,7 +7,7 @@ import Text.Parsec.String
message :: Parser Message
message =
- Message <$> optionMaybe (char ':' *> prefix) <* spaces1 <*> command <*> params
+ Message <$> optionMaybe (char ':' *> prefix <* spaces1) <*> command <*> params
where
spaces1 = skipMany1 space
prefix = Prefix <$> nick
@@ -16,7 +16,7 @@ message =
nick = many1 (noneOf " !@")
user = many1 (noneOf " !@")
host = many1 (noneOf " !@")
- command = UnknownCommand <$> many1 nonspace
+ command = many1 nonspace
params = many1 (spaces1 *> (trailing <|> middle))
trailing = char ':' *> many1 anyChar
middle = many1 nonspace
diff --git a/Hirc/Types.hs b/Hirc/Types.hs
index 1bb258c..2567b53 100644
--- a/Hirc/Types.hs
+++ b/Hirc/Types.hs
@@ -1,5 +1,9 @@
module Hirc.Types where
+type Command = String
+type Param = String
+type Receiver = String
+
data Message =
Message {
m_prefix :: Maybe Prefix,
@@ -8,8 +12,6 @@ data Message =
}
deriving Show
-type Param = String
-
data Prefix =
Prefix {
p_name :: String,
@@ -18,9 +20,3 @@ data Prefix =
}
deriving Show
-data Command =
- PRIVMSG Receiver [Receiver] String |
- UnknownCommand String
- deriving Show
-
-type Receiver = String