packages feed

hranker-0.1: Hranker.hs

import Hranker.CommandLine (clMain)
import Hranker.Rank (highestRank)

import Control.Monad (when)
import System.Environment (getArgs)
import System.Exit (exitFailure)

usage :: IO ()
usage = do
    putStrLn $ "To rank a series of integers from " ++ show highestRank ++ " to N, type hranker N"
    putStrLn "To rank any other sequence of items, you will need to either edit the source code of this program,"
    putStrLn "or use Hranker.CommandLine.clMain from ghci."
    exitFailure

main :: IO ()
main = do
    args <- getArgs
    when (null args) usage
    let arg1 = head args
    when (head arg1 == '-') usage
    clMain [1..read arg1]