Extracting file extension (extname) from Text or String
haskell
Solution
Another way would be to use `System.Filepath`:
λ> import System.FilePath
λ> snd $ splitExtension "/foo/bar/foobar.txt"
".txt"
You can also use `takeExtension` as pointed out by @kosmikus:
λ> takeExtension "/foo/bar/foobar.txt"
".txt"
Problem
I have a `Text` or `String` containing a filename, say `/foo/bar/foobar.txt`. How can I defined a function `extname` (similar to NodeJS's extname, but omitting the leading dot) that only yields the extension (`txt` for the example?)