windowshaskellversionbuild-numbers

Get windows build number in Haskell


How can I get windows build number in Haskell? I think I can use readProcess and ver, but maybe there are more clear methods.


Solution

  • The Win32 package seems to allow to access the build number, within the IO monad. Untested.

    import System.Win32.Info.Version -- from Win32 package
    
    main :: IO ()
    main = do
       osVersionInfo <- getVersionEx
       print (dwBuildNumber osVersionInfo)