1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

『プログラミングHaskell』の電卓をWindowsでも動くようにする

Posted at

テキストのソースコードはOSがUnix系でないと動かない書き方になっていますが、次のように書き直せば、Windowsでも動くようになります。

calculator.lhs
> import System.Console.ANSI
>
> cls                           :: IO ()
> -- cls                           =  putStr "\ESC[2J"
> cls                           =  clearScreen 
>
> type Pos                      =  (Int,Int)
> 
> goto                          :: Pos -> IO ()
> --goto (x,y)                    =  putStr ("\ESC[" ++ show y ++ ";" ++ show x ++ "H")
> goto (x, y) = setCursorPosition y x

System.Console.ANSIcabal install ansi-terminalでインストールすれば使えるようになります。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?