X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Futils%2FUtil.lhs;h=b9679177534b9f9914707d4bf31e379696783a3f;hb=c9b6b5e89b9f75bc40a9964fdd154242dd4ed45b;hp=90e7042baeae775d3f7bcee042ef1f5128fccf3c;hpb=047864943968324c12c9252c69f32672bec241cb;p=ghc-hetmet.git diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 90e7042..b967917 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -70,6 +70,7 @@ module Util ( splitLongestPrefix, escapeSpaces, parseSearchPath, + Direction(..), reslash, ) where -- XXX This define is a bit of a hack, and should be done more nicely @@ -841,4 +842,17 @@ searchPathSeparator = ';' #else searchPathSeparator = ':' #endif + +data Direction = Forwards | Backwards + +reslash :: Direction -> FilePath -> FilePath +reslash d = f + where f ('/' : xs) = slash : f xs + f ('\\' : xs) = slash : f xs + f (x : xs) = x : f xs + f "" = "" + slash = case d of + Forwards -> '/' + Backwards -> '\\' \end{code} +