小编Dar*_*721的帖子

Haskell IO,在同一行中获取两个输入并进行验证

module TicTacToe (tictactoe) where

import Control.Applicative
import Control.Monad
import Control.Monad.State

import Data.Char
import Data.List

import Text.Printf

tictactoe :: IO ()
tictactoe = do
  let grid = [' ',' ',' ',' ',' ',' ',' ',' ',' ']
  let count = 0
  output_grid grid count
  
  
output_grid :: String -> Int -> IO()
output_grid grid count = do
  putStr ".---.---.---.\n"
  printf "| %c | %c | %c |\n" (grid !! 0) (grid !! 1) (grid !! 2)
  putStr ".---.---.---.\n"
  printf "| %c | …
Run Code Online (Sandbox Code Playgroud)

io validation parsing haskell types

4
推荐指数
1
解决办法
100
查看次数

标签 统计

haskell ×1

io ×1

parsing ×1

types ×1

validation ×1