
Thanks! I'll give that a try (what I found interesting of using getEnv, though, is that it seems simple to use arbitrary variables I set for ad-hoc needs in .profile, even if it is kind of a kludge).
Best,
R.
On Tue, 20-September-2022, at 06:58:14, Platon Pronko
Using environment variables to get hostname feels a bit unstable. I personally read /etc/hostname to determine the hostname, like this:
hostname <- fmap trimString (readFile "/etc/hostname")
where `trimString` is:
trimString :: String -> String trimString = f . f where f = reverse . dropWhile isSpace
There's also `hostname` package, which uses proper library functions to determine hostname: https://hackage.haskell.org/package/hostname
-- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-31 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdiaz02@gmail.com r.diaz@uam.es https://ligarto.org/rdiaz