学習ログ
-- user.hs data UserInfo = UserInfo{ userId :: Int , name :: String } deriving(Show)
relude> :load user.hs [1 of 1] Compiling Main ( user.hs, interpreted ) Ok, modules loaded: Main. *Main> let user = UserInfo 1 "haru01" *Main> :type userId userId :: UserInfo -> Int *Main> userId user 1 *Main> name user "haru01" *Main> let user2 = UserInfo { userId = 2, name = "haru02" } *Main> name user2 "haru02"
"UserInfo { userId = 2, name = "haru02" }"の表記、いいなぁ
Real World Haskell: Code You Can Believe In
- 作者: Bryan O'Sullivan,John Goerzen,Donald Bruce Stewart
- 出版社/メーカー: O'Reilly Media
- 発売日: 2008/12/05
- メディア: ペーパーバック
- 購入: 2人 クリック: 78回
- この商品を含むブログ (40件) を見る