diff options
author | defanor <defanor@uberspace.net> | 2018-01-23 15:28:05 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2018-01-23 15:28:05 +0300 |
commit | 11e83528df0f4e48d9324b2e4dd82dc58792fb16 (patch) | |
tree | 28b256af09b52717552f41c98ccfb32626ca0c3b /Pancake/Common.hs | |
parent | 9e58afe6f706aa4db06e82b35abf329368a0de98 (diff) |
Add initial RDF support
With two types of caching: file-based for retrieved documents, and
memory-based for predicate labels extracted from those.
Diffstat (limited to 'Pancake/Common.hs')
-rw-r--r-- | Pancake/Common.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Pancake/Common.hs b/Pancake/Common.hs index ee21ab3..d107a02 100644 --- a/Pancake/Common.hs +++ b/Pancake/Common.hs @@ -24,9 +24,11 @@ Portability : portable Utility functions. -} -module Pancake.Common ( putErrLn ) where +module Pancake.Common ( putErrLn, escapeURI ) where import System.IO import Control.Monad.IO.Class +import Network.URI +import System.FilePath -- | Prints a line into stderr. @@ -34,3 +36,10 @@ putErrLn :: MonadIO m => String -> m () putErrLn s = liftIO $ do hPutStrLn stderr s hFlush stderr + +-- | Escapes an URI for use as a file name. +escapeURI :: URI -> FilePath +escapeURI u = map escapeChar $ uriToString id u "" + where escapeChar c + | isPathSeparator c = '-' + | otherwise = c |