Haskell programming makes code not work

I am in chapter 9.6 of the book Programming in Haskell, page 91. It is assumed that the function writeatshould write the given string at the given location on the command line, but this does not work for me.

type Pos = (Int, Int)

goto        :: Pos -> IO ()
goto (x, y) = putStr ("\ESC[" ++ show y ++ ";" ++ show x ++ "H")

writeat     :: Pos -> String -> IO ()
writeat p xs = do
    goto p
    putStr xs

But he does not do what the book says. Is it because I'm on Windows? If so, is there a workaround?

+4
source share
1 answer

Yes, this is because you are at the windows. These are ANSI escape sequences, and Windows does not support them: http://en.wikipedia.org/wiki/ANSI_escape_code#Windows_and_DOS

, cygwin mintty, , TERM , ANSI; haskell Linux, xterm (, fpcomplete: https://www.fpcomplete.com/page/haskell-eval-vm). .

+4

Source: https://habr.com/ru/post/1529452/


All Articles