File: ReadArgsEx.hs

package info (click to toggle)
haskell-readargs 1.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 80 kB
  • ctags: 1
  • sloc: haskell: 240; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 542 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{-# LANGUAGE ScopedTypeVariables #-}
module Main where

import ReadArgs

-- try running this  with a couple sample inputs
--  % ReadArgsEx
--  usage: ReadArgsEx [Char] String [Int...] Char
--  % ReadArgsEx hello x
--  (Nothing, "hello", [], 'x')
--  % ReadArgsEx a hello x
--  (Just 'a', "hello", [], 'x')
--  % ReadArgsEx hello 1 2 3 x
--  (Nothing, "hello", [1,2,3], 'x')
--  % ReadArgsEx a hello 1 2 3 x
--  (Just 'a', "hello", [1,2,3], 'x')
main = do 
  (a :: Maybe Char, b :: String, c :: [Int], d :: Char) <- readArgs
  print (a,b,c,d)