My Function is
import System.IO
import Debug.Trace
main :: IO ()
main = do
datei <- openFile "palindrom.txt" ReadMode
palin <- hGetContents datei
putStrLn $ unlines [ check x | x <- lines palin]
check :: String -> String
check x
| null x = ""
| trace ("call check "++ show x) False = x
| x == (reverse x) = if null x then ""
else do x ++ " Palindrom length " ++ show (length x)
I get the Exception Non-exhaustive patterns in the function `check`.
How can I match the string to complete the pattern, I tried also the empty String ""
or I am even not able to use this kind of pattern on a String in Haskell?
ps: The palindrom.txt is
a
aa
ab
aha
anna
anne
bry
bub