clean up because of warnings - -Wall doesn't have anything interesting to say anymore

This commit is contained in:
Alp Mestanogullari 2014-06-03 12:14:39 +02:00
parent 9583cda388
commit a9dac8c435
3 changed files with 13 additions and 14 deletions

View File

@ -3,9 +3,9 @@
module Text.Taggy.DOM where
import Data.Text (Text)
import qualified Data.Text as T
import Text.Taggy.Types
-- TODO: provide lenses for this
data Tree = Branch !Text [Attribute] [Tree]
| Leaf !Tag
deriving (Eq, Show)
@ -14,7 +14,6 @@ domify :: [Tag] -> [Tree]
domify [] = []
domify xs = go xs
where go [] = []
go ts = a ++ map Leaf (take 1 b) ++ go (drop 1 b)
where (a, b) = f ts
@ -26,22 +25,22 @@ domify xs = go xs
f $ [tago, TagText sty, tagc] ++ rest
f (TagOpen name attrs autocl : rest) =
f (TagOpen name as autocl : rest) =
case f rest of
(inner, []) -> ( Leaf (TagOpen name attrs autocl) : inner
(inner, []) -> ( Leaf (TagOpen name as autocl) : inner
, []
)
(inner, TagClose x : ts)
| x == name ->
let (a, b) = f ts in
(Branch name attrs inner : a, b)
(Branch name as inner : a, b)
| otherwise ->
( Leaf (TagOpen name attrs autocl) : inner
( Leaf (TagOpen name as autocl) : inner
, TagClose x : ts
)
_ -> error "Text.Taggy.DOM.domify: shouldn't happen"
f (TagClose x:xs) = ([], TagClose x : xs)
f (x:xs) = (Leaf x : a, b)
where (a,b) = f xs
f (TagClose x:ts) = ([], TagClose x : ts)
f (x:ts) = (Leaf x : a, b)
where (a,b) = f ts
f [] = ([], [])

View File

@ -46,9 +46,9 @@ delimitedByTag :: T.Text -> Parser (Tag, T.Text, Tag)
delimitedByTag t = do
char '<'
string t
(attrs, _) <- attributes
(as, _) <- attributes
inside <- matchUntil $ "</" <> t <> ">"
return (TagOpen t attrs False, inside, TagClose t)
return (TagOpen t as False, inside, TagClose t)
tagcomment :: Parser Tag
tagcomment = do
@ -78,8 +78,8 @@ tagopen = do
possibly '!'
skipSpace
i <- ident
(attrs, autoclose) <- attributes
return $ TagOpen i attrs autoclose
(as, autoclose) <- attributes
return $ TagOpen i as autoclose
tagclose :: Parser Tag
tagclose = do

View File

@ -56,7 +56,7 @@ isTagStyle (TagStyle _ _ _) = True
isTagStyle _ = False
tagsNamed :: Text -> [Tag] -> [Tag]
tagsNamed n = filter (named n)
tagsNamed nam = filter (named nam)
where named n (TagOpen t _ _) = toCaseFold n == toCaseFold t
named _ _ = False