module Exercise04 where {-WETT-} tag:: String -> Bool -> (String,String,Bool) tag [] _ = (" "," ",False) tag ('>':ss) _ = (" ",ss,True) tag (' ':ss) _ = tag ss False tag (s:ss) b | b = (s:xs,ys,br) | otherwise = (" "," ",False) where (xs,ys,br) = tag ss b xml:: String -> [String] -> Bool xml [] [] = False xml [] [""] = True xml [] (_:_) = False xml ('>':_) _ = False xml ('<':ss) (x:xs) = if t == '/' then x == ts && valid && xml r xs else valid && xml r ((t:ts):x:xs) where (t:ts,r,valid) = tag ss True xml (_:ss) xs = xml ss xs xmlLight :: String -> Bool xmlLight s = xml s [""] {-TTEW-}