2020-09-22から1日間の記事一覧

ファイルを作る+書く @rust

use std::fs::File; use std::io::prelude::*; fn main() -> std::io::Result<()> { let mut file = File::create("foo.txt"); file.write_all(b"Hello, world")?; OK(()) }

ファイルを読む @haskell

import System.IO main = do fileName <- getLine let content = readFile fileName putStrLn content [1 of 1] Compiling Main ( main.hs, main.o ) main.hs:6:14: error: • Couldn't match type ‘IO String’ with ‘[Char]’ Expected type: String Actual t…