Take the 2-minute tour ×

I have developed a haskell application which is tested with WinHugs interpreter working fine .. when i try to comiple the same application using WinGHCi it prompts a error

   lexical error in string/character literal at character '\t'

I have used \t in IO Program to display text

Example :- putStr "\n \n \t \t Hello ! "

Any solutions ?

share|improve this question
As I understand it, it's pretty hard to use an interpreter for compilation ;-) –  Thomas M. DuBuisson Jun 11 '11 at 18:05
i was using GHCi its a compiler r8 ? :-o –  Sudantha Jun 11 '11 at 18:06
Strictly speaking, GHCi is an interpreter. Don't mind me, I'm just playing with terminology. As for your problem, it might help if you posted a minimum code snippet that displayed the issue. –  Thomas M. DuBuisson Jun 11 '11 at 18:10
Can you please post a minimal piece of code that produces your error? Thanks. –  FUZxxl Jun 11 '11 at 18:11
@Sudantha Your code is completely strange. First, the definition of menu must not be indented and second a string must end on the same line, except if you're using a `\` at the end of the line and a second one at the beginning of the next line to continue the string. –  FUZxxl Jun 11 '11 at 19:15

1 Answer 1

up vote 2 down vote accepted

You may want to try this step-by-step guide:

  1. Save your program in a file program.hs this file should contain a function main of the type IO () that is executed at the program's start.
  2. Open a shell in the directory where this file is.
  3. Type ghc -O3 --make program.hs to compile program.hs into an executable program.exe.
  4. Try to run program.exe

If the error still occurs, please post some more code to aid debugging.

share|improve this answer
Thanks FUZxxl i found the error was using space bar to keep spaces instead of \t –  Sudantha Jun 11 '11 at 18:59

Your Answer


