diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-12 01:02:14 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-12 01:02:14 +0000 |
commit | c1da385941598c8e31f0e3b72f34797afe964bc9 (patch) | |
tree | 149ba6405414360d83f24f1aab6c3a2644c67510 /bbcode | |
parent | fea4f8690111a8bbb65845fb61961cfc0a9802cc (diff) | |
download | thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar.gz thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar.bz2 thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.tar.xz thermoprint-c1da385941598c8e31f0e3b72f34797afe964bc9.zip |
minor code cleanup
Diffstat (limited to 'bbcode')
-rw-r--r-- | bbcode/src/Text/BBCode/Lexer.hs | 9 | ||||
-rw-r--r-- | bbcode/test/Text/BBCode/LexerSpec.hs | 2 |
2 files changed, 3 insertions, 8 deletions
diff --git a/bbcode/src/Text/BBCode/Lexer.hs b/bbcode/src/Text/BBCode/Lexer.hs index 01f47f0..a7294fe 100644 --- a/bbcode/src/Text/BBCode/Lexer.hs +++ b/bbcode/src/Text/BBCode/Lexer.hs | |||
@@ -12,20 +12,15 @@ module Text.BBCode.Lexer | |||
12 | import Data.Attoparsec.Text | 12 | import Data.Attoparsec.Text |
13 | 13 | ||
14 | import Data.Text (Text) | 14 | import Data.Text (Text) |
15 | import qualified Data.Text as T (singleton, head, last, tail, null) | 15 | import qualified Data.Text as T (singleton) |
16 | 16 | ||
17 | import Control.Applicative | 17 | import Control.Applicative |
18 | 18 | ||
19 | import Test.QuickCheck (Arbitrary(..), CoArbitrary, genericShrink) | ||
20 | import Test.QuickCheck.Gen (oneof, suchThat) | ||
21 | import Test.QuickCheck.Instances | ||
22 | import GHC.Generics (Generic) | ||
23 | |||
24 | -- | Our lexicographical unit | 19 | -- | Our lexicographical unit |
25 | data BBToken = BBOpen Text -- ^ Tag open | 20 | data BBToken = BBOpen Text -- ^ Tag open |
26 | | BBClose Text -- ^ Tag close | 21 | | BBClose Text -- ^ Tag close |
27 | | BBStr Text -- ^ Content of a tag | 22 | | BBStr Text -- ^ Content of a tag |
28 | deriving (Generic, Eq, Show) | 23 | deriving (Eq, Show) |
29 | 24 | ||
30 | token :: Parser BBToken | 25 | token :: Parser BBToken |
31 | -- ^ Tokenizer | 26 | -- ^ Tokenizer |
diff --git a/bbcode/test/Text/BBCode/LexerSpec.hs b/bbcode/test/Text/BBCode/LexerSpec.hs index 8b95874..b0b77d9 100644 --- a/bbcode/test/Text/BBCode/LexerSpec.hs +++ b/bbcode/test/Text/BBCode/LexerSpec.hs | |||
@@ -44,7 +44,7 @@ spec = do | |||
44 | zipWithM_ example [1..] examples | 44 | zipWithM_ example [1..] examples |
45 | where | 45 | where |
46 | example n (s, ts) = let str = "Example " <> show n | 46 | example n (s, ts) = let str = "Example " <> show n |
47 | in specify str $ (tokenize s == Right ts) | 47 | in specify str (tokenize s == Right ts) |
48 | 48 | ||
49 | prop_token :: Text -> Property | 49 | prop_token :: Text -> Property |
50 | -- ^ prop> (mconcat . map coToken) <$> tokenize x == Right x | 50 | -- ^ prop> (mconcat . map coToken) <$> tokenize x == Right x |