diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-30 00:08:02 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-30 00:08:02 -0400 |
| commit | 92957b27ece2d4fb2eb4ce9121dd26ee94985b48 (patch) | |
| tree | c25c4dbd5d497958ba011ad7382ab92fc3cc8f45 /HostName.hs | |
| parent | 0ab0216d0b400fae78a6a6916ef9f82ed31dc0fa (diff) | |
cabalized and added a wrapper program
Diffstat (limited to 'HostName.hs')
| -rw-r--r-- | HostName.hs | 16 |
1 files changed, 16 insertions, 0 deletions
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." |
