I'm going through Real world Haskell, and got to the example:
-- file: ch04/InteractWith.hs
-- Save this in a source file, e.g. Interact.hs
import System.Environment (getArgs)
interactWith function inputFile outputFile = do
input <- readFile inputFile
writeFile outputFile (function input)
main = mainWith myFunction
where mainWith function = do
args <- getArgs
case args of
[input,output] -> interactWith function input output
_ -> putStrLn "error: exactly two arguments needed"
-- replace "id" with the name of our function below
myFunction = id
But when I try to compile it (ghc --make InteractWith
) I get this error:
$ ghc --make InteractWith
[1 of 1] Compiling Main ( InteractWith.hs, InteractWith.o )
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:309:0:
suffix or operands invalid for `push'
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:358:0:
suffix or operands invalid for `push'
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:384:0:
32-bit absolute addressing is not supported for x86-64
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:384:0:
cannot do signed 4 byte relocation
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:387:0:
32-bit absolute addressing is not supported for x86-64
/var/folders/38/38dlZO7fEXyCgGIFUZA0Ok+++TI/-Tmp-/ghc91310_0/ghc91310_0.s:387:0:
cannot do signed 4 byte relocation
I'm using GHC 6.10.4 on Mac OS 10.6 (Snow Leopard).