{- -*- Coding: utf-8 -*- -} import qualified System.IO.UTF8 as U import Network.URI import System.Directory import Text.HyperEstraier main = do withDatabase "casket" (Writer [Create []]) $ \ db -> do doc <- newDocument let Just uri = parseURI "http://example.net/hello" setURI doc (Just uri) addText doc "Hello, world!" putStrLn ">> Registering the following document:" dumpDraft doc >>= putStr putDocument db doc [] docID <- getId doc putStrLn (">> Done. The document got ID " ++ show docID ++ ".") putStrLn ">> Trying to search for \"World OR dlroW\"..." cond <- newCondition setPhrase cond "World OR dlroW" result <- searchDatabase db cond putStrLn (">> Found: " ++ show result) U.putStrLn ">> Trying to search for \"hêllö\"..." cond' <- newCondition setPhrase cond "hêllö" result' <- searchDatabase db cond putStrLn (">> Found: " ++ show result') if null result' then U.putStrLn ">> Great, hêllö doesn't match to hello." else U.putStrLn (">> hêllö matches to hello... This seems to be indeed a desired behavior, " ++ "but this may cause problems on languages where diacritical marks are " ++ "significant to distinguish completely different words...") removeDirectoryRecursive "casket"