{-# LANGUAGE OverloadedStrings #-}
module OpenTelemetry.Resource.OperatingSystem.Detector (
detectOperatingSystem,
) where
import qualified Data.Text as T
import OpenTelemetry.Resource.OperatingSystem
import System.Info (os)
detectOperatingSystem :: IO OperatingSystem
detectOperatingSystem :: IO OperatingSystem
detectOperatingSystem =
OperatingSystem -> IO OperatingSystem
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (OperatingSystem -> IO OperatingSystem)
-> OperatingSystem -> IO OperatingSystem
forall a b. (a -> b) -> a -> b
$
OperatingSystem
{ osType :: Text
osType =
if String
os String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
"mingw32"
then Text
"windows"
else String -> Text
T.pack String
os
, osDescription :: Maybe Text
osDescription = Maybe Text
forall a. Maybe a
Nothing
, osName :: Maybe Text
osName = Maybe Text
forall a. Maybe a
Nothing
, osVersion :: Maybe Text
osVersion = Maybe Text
forall a. Maybe a
Nothing
}