[Haskell-cafe] IO platform for testing

Isaac Jones ijones at syntaxpolice.org
Sun Jul 17 01:00:58 EDT 2005

yin <yin at atom.sk> writes:

> first I have to apologise for my English.

Don't worry about that.

> ./bundle01 <cmd> <arg1> <arg2> ...
> I more apoarches, but no one worked. Now I tried this:
>    m01_mod :: Int -> Int -> Int

What's m01?  You define b01 below:

>    b01_mod a b = a mod b

You must type that "mod a b" or "a `mod` b".

>    main = do
>        (cmd:ss) <- getArgs
>        putStrLn (
>            if (cmd == "mod") then do

You don't need the "do" here.  Since the type of the entire "if"
statement is a String (not an IO String) this is an error.

>                show (b01_mod (read (ss!!1)) (read (ss!!2)))
>            else do
>                "unknown command!")
> Please, send me somethung like this (I need to understand it). I need
> runing more <cmd>s and with various argument counts and types. All
> functions "in a bundle" should be in one file.

Otherwise, looks roughly correct to me... The program will crash with
a meaningless error if they don't enter any args.



More information about the Haskell-Cafe mailing list