1
votes

I'm trying to write an IO program that reverses text, but it just can't work. I've tried to adjust the indention of reverse function, still, it didn't work.

The full error message is :

reverse.hs:11:1: parse error (possibly incorrect indentation or mismatched brackets)

--reverse a file
module Main where

import System.IO

main = do
  putStrLn "reading a file..."
  theInput <- readFile "input.txt"
  writeFile "output.txt" $ reverse` theInput

reverse` :: String -> String
reverse` [] = []
reverse` (_:xs) = reverse xs : _ 
1
This is a grave error - SingleNegationElimination
@IfLoop Your puns are barely functional. - Daniel Gratzer
@jozefg Your puns are just lazy. - error_null_pointer

1 Answers

6
votes

You can't use a backtick as part of an identifier. It's a syntactic token for using a function name as an inline operator (e.g. compare `on` thing). You probably wanted a normal tick mark (').