:: FilePath -> String -package:Cabal -package:hedgehog -package:haskell-gi-base -package:system-filepath
Get the extension of a file, returns
"" for no extension,
.ext otherwise.
takeExtension "/directory/path.ext" == ".ext"
takeExtension x == snd (splitExtension x)
Valid x => takeExtension (addExtension x "ext") == ".ext"
Valid x => takeExtension (replaceExtension x "ext") == ".ext"
Get all extensions.
takeExtensions "/directory/path.ext" == ".ext"
takeExtensions "file.tar.gz" == ".tar.gz"
Get the base name, without an extension or path.
takeBaseName "/directory/file.ext" == "file"
takeBaseName "file/test.txt" == "test"
takeBaseName "dave.ext" == "dave"
takeBaseName "" == ""
takeBaseName "test" == "test"
takeBaseName (addTrailingPathSeparator x) == ""
takeBaseName "file/file.tar.gz" == "file.tar"
Derive module name from specified path.
Deprecated: Use id instead
Retrieve a
FilePath's basename component
The golden test context for adding context to a golden test assertion:
goldenTestCompare = \actual expected ->
if actual == expected
then Nothing
else Just $ Context (stringsNotEqualButShouldHaveBeenEqual actual expected) (goldenContext fp)
Convert a filepath to an URL starting from the site root
Example:
toUrl "foo/bar.html"
Result:
"/foo/bar.html"
This also sanitizes the URL, e.g. converting spaces into '%20'
Get the extension of a file, returns
"" for no extension,
.ext otherwise.
takeExtension x == snd (splitExtension x)
Valid x => takeExtension (addExtension x "ext") == ".ext"
Valid x => takeExtension (replaceExtension x "ext") == ".ext"
Get all extensions
takeExtensions "file.tar.gz" == ".tar.gz"
Get the base name, without an extension or path.
takeBaseName "file/test.txt" == "test"
takeBaseName "dave.ext" == "dave"
takeBaseName "" == ""
takeBaseName "test" == "test"
takeBaseName (addTrailingPathSeparator x) == ""
takeBaseName "file/file.tar.gz" == "file.tar"
Get the Haskell module name corresponding to a given .proto file.
Cannot-open-file message.
given a string, return a key that can be used in Indexable instances
Of non persistent objects, such are cached objects (it changes fron
execution to execution) . It uses
addrHash
Show any value
This shows any value, as long as it's not unlifted. The result should
be equal to show instances, with the following caveats:
- User-defined types (types not explicitly known to this library)
with a custom Show instance will still be showable, but the
result will be what the derived show instance would have
done.
- Record field names are not known at runtime, so they are not
shown.
- UNPACKed data is not visible to this library (if you compile with
-O0 ghc will not unpack data, so that might be a
workaround if necessary).
If classification fails, we show the actual closure.