case x of是没有otherwise的

module Main where

import System.Environment(getArgs)
import qualified Data.ByteString as B (readFile, writeFile, map)

main = do
  args <- getArgs
  case args of
    [from, out, direction] ->
      case direction of 
      "exe2txt" -> do
        s <- B.readFile from
        let s1 = B.map (/x->x+1) s
        B.writeFile out s1
      "txt2exe" -> do
        s <- B.readFile from
        let s1 = B.map (/x->x-1) s
        B.writeFile out s1
      _ -> do
        Prelude.putStrLn "usage: hs20101004-1.exe from out direction"
    _ ->
      Prelude.putStrLn "usage: hs20101004-1.exe from out direction"

你可能感兴趣的:(Module,exe,import,2010)