Haskell standard function for extending environment variables

I am looking for something similar to Python os.path.expandvarsin Haskell, i.e. a function FilePath -> IO FilePaththat

  • Cross-platform (supports Windows %VAR%and Unix styles $VAR)
  • Standard (I do not want to write my own function for this).

Example:

> expandVars "$HOME/foo/bar"
"/home/someuser/foo/bar"

I searched on Hoogle, Hayoo, and Google, but didn't find anything, which is surprising given the number of cross-platform Haskell tools. The closest I found this implementation is for Unix only . Perhaps there is some kind of project that implements this as a subroutine?

+4
source share

Source: https://habr.com/ru/post/1691045/


All Articles