0

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 ?

12
  • 1
    As I understand it, it's pretty hard to use an interpreter for compilation ;-) Commented Jun 11, 2011 at 18:05
  • i was using GHCi its a compiler r8 ? :-o Commented Jun 11, 2011 at 18:06
  • 2
    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. Commented Jun 11, 2011 at 18:10
  • Can you please post a minimal piece of code that produces your error? Thanks. Commented Jun 11, 2011 at 18:11
  • 1
    @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. Commented Jun 11, 2011 at 19:15

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks FUZxxl i found the error was using space bar to keep spaces instead of \t

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.