正如问题所述,我试图在类图中指出一个类型的"多个" - 例如,我的类是一个讲座:
Lecture
topic : String
lecturer : String
timeStart : Time
studentsAttending : **Insert indication of list of students here**
Run Code Online (Sandbox Code Playgroud) 试图将两种数据类型的笛卡尔积产品放入一个列表中:
data X = hello | goodbye | hi
deriving (ord, enum, eq, show)
data Y = hello | goodbye | hi
deriving (ord, enum, eq, show)
compList :: [a]
compList = [(x, y) | x <- X, y <- Y]
Run Code Online (Sandbox Code Playgroud)
显然x < - X等目前不起作用,我只是想知道你们怎么会这样做?
干杯.