-- | Try to get the name of the current operating system.
os :: Maybe OS
os = unsafePerformIO do
  -- unsafePerformIO and NOINLINE guarantee that c_getOS won't be called more than once
  osptr <- c_getOS
  if osptr == nullPtr
  then pure Nothing
  else do
    res <- peekCWString osptr
    free osptr
    pure $ Just $ OS res

os :: Maybe OS
os = unsafePerformIO do
  -- unsafePerformIO and NOINLINE guarantee that c_getOS won't be called more than once
  osptr <- c_getOS
  if osptr == nullPtr
  then pure Nothing
  else do
    res <- peekCWString osptr
    free osptr
    pure $ Just $ OS res

os = unsafePerformIO do
  -- unsafePerformIO and NOINLINE guarantee that c_getOS won't be called more than once
  osptr <- c_getOS
  if osptr == nullPtr
  then pure Nothing
  else do
    res <- peekCWString osptr
    free osptr
    pure $ Just $ OS res
