當編譯如下:參數化類型的類型參數
data Rec t = Rec { intPt :: t Int, doublePt :: t Double } deriving Show
type Pt2 a = (a,a)
type Pt3 a = (a,a,a)
type Rec2 = Rec Pt2
type Rec3 = Rec Pt3
main = do
print $ Rec (1,2) (3.4,5.6)
print $ Rec (1,2,3) (5.6, 7.8, 9.0)
我
Unexpected type `t a' where type variable expected
In the declaration of `Rec (t a)'
如何使這個編譯和工作?
我downvoting這一點,因爲我認爲你發佈的代碼是不是產生了錯誤,這是相當無用的代碼。 –