-- | Common definitions for @-v@ and @-h@, given the list of all other
-- options.
commonOptions :: [FunOptDescr cfg] -> [FunOptDescr cfg]
commonOptions options =
  [ Option "v" ["version"]
    (NoArg $ Left $ do header
                       exitSuccess)
    "Print version information and exit."

  , Option "h" ["help"]
    (NoArg $ Left $ do header
                       putStrLn ""
                       putStrLn =<< usageStr (commonOptions [] ++ options)
                       exitSuccess)
    "Print help and exit."
  ]
  where header = do
          putStrLn $ "Futhark " ++ versionString
          putStrLn "(C) HIPERFIT research centre"
          putStrLn "Department of Computer Science, University of Copenhagen (DIKU)"
commonOptions :: [FunOptDescr cfg] -> [FunOptDescr cfg]
commonOptions options =
  [ Option "v" ["version"]
    (NoArg $ Left $ do header
                       exitSuccess)
    "Print version information and exit."

  , Option "h" ["help"]
    (NoArg $ Left $ do header
                       putStrLn ""
                       putStrLn =<< usageStr (commonOptions [] ++ options)
                       exitSuccess)
    "Print help and exit."
  ]
  where header = do
          putStrLn $ "Futhark " ++ versionString
          putStrLn "(C) HIPERFIT research centre"
          putStrLn "Department of Computer Science, University of Copenhagen (DIKU)"
commonOptions options =
  [ Option "v" ["version"]
    (NoArg $ Left $ do header
                       exitSuccess)
    "Print version information and exit."

  , Option "h" ["help"]
    (NoArg $ Left $ do header
                       putStrLn ""
                       putStrLn =<< usageStr (commonOptions [] ++ options)
                       exitSuccess)
    "Print help and exit."
  ]
  where header = do
          putStrLn $ "Futhark " ++ versionString
          putStrLn "(C) HIPERFIT research centre"
          putStrLn "Department of Computer Science, University of Copenhagen (DIKU)"