From 92957b27ece2d4fb2eb4ce9121dd26ee94985b48 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 30 Mar 2014 00:08:02 -0400 Subject: cabalized and added a wrapper program --- HostName.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 HostName.hs (limited to 'HostName.hs') diff --git a/HostName.hs b/HostName.hs new file mode 100644 index 00000000..dfe9efb4 --- /dev/null +++ b/HostName.hs @@ -0,0 +1,16 @@ +module HostName where + +import Data.Maybe +import Control.Applicative +import System.Environment + +import qualified Utility.Network as Network + +type HostName = String + +getHostName :: IO HostName +getHostName = go =<< getArgs + where + go (h:_) = return h + go [] = fromMaybe nohostname <$> Network.getHostname + nohostname = error "Cannot determine hostname! Pass it on the command line." -- cgit v1.3-2-g0d8e