"Alexandre Weffort Thenorio" <[EMAIL PROTECTED]> writes: > outputLine keyno key orgFile = do > part1 <- getLeft keyno orgFile > part2 <- getRight keyno orgFile > total <- part1 ++ (strUpper key) ++ part2 ++ "\n" > newHexFile <- openFileEx "newfile" (BinaryMode WriteMode) > hPutStrLn newHexFile (orgFile!!0 ++ "\n" ++ total ++ unlines (drop 2 > orgFile))
outputLine keyno key orgFile = do let part1 = getLeft keyno orgFile let part2 = getRight keyno orgFile let total = part1 ++ (strUpper key) ++ part2 ++ "\n" newHexFile <- openFileEx "newfile" (BinaryMode WriteMode) hPutStrLn newHexFile (orgFile!!0 ++ "\n" ++ total ++ unlines (drop 2 orgFile)) "let ... =" instead of "<-" because getLeft et al. aren't IO commands. (Why type error rather than syntax error then? Because getLeft returns a list, and list is a monad too. E.g., do { part1 <- getLeft keyno orgFile; return part1 } = [ part1 | part1 <- getLeft keyno orgFile ] so part1 is inferred to be a Char.) There will be another problem. The type of orgFile is expected to be String here, but the callsite gives it "lines(hexFile)" of type [String]. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe