generated at
直積型

複数の値を同時に保持するデータ構造
TSでは普通にobjectで定義したような型はこれになるのか?







交換律, 結合律を満たす
a\times b種類の値を持つ
hs
-- 結合律 assocL2R :: Product (Product a b) c -> Product a (Product b c) assocL2R (Product (Product a b) c) = Product a (Product b c) -- 結合律 assocR2L :: Product a (Product b c) -> Product (Product a b) c assocR2L (Product a (Product b c)) = Product (Product a b) c -- 交換律 commute :: Product a b -> Product b a commute (Product a b) = Product b a



言語例
sml
ml
datatype person = Person of string * int
Haskell
hs
data Product a b = Product a b

参考