Legend:

Please put examples here, if possible using the above notation. The aim is to find out which features of the various systems are important in practice, so uncontrived examples which illustrate differences between the systems are wanted!

82

82

83

1 An example to show the need for extra polymorphism in unpermuted records:

83

An example to show the need for extra polymorphism in unpermuted records:

84

84

{{{

85

type Point = {x :: Float, y :: Float}

85

type Point = {X :: Float, Y :: Float}

86

86

87

87

norm :: Point -> Float

88

norm p = sqrt (p.x * p.x + p.y * p.y)

88

norm p = sqrt (p.X * p.X + p.Y * p.Y)

89

89

90

norm {y = 3.0, x = 4.0} -- this is a type error

90

norm {Y = 3.0, X = 4.0} -- this is a type error, because X and Y are in the wrong order

91

91

92

norm' :: (Select x a Float, Select y a Float) => a -> Float

93

norm' p = sqrt (p.x * p.x + p.y * p.y)

92

norm' :: (Select X a Float, Select Y a Float) => a -> Float

93

norm' p = sqrt (p.X * p.X + p.Y * p.Y)

94

94

95

norm' {y = 3.0, x = 4.0} -- this is OK

95

norm' {Y = 3.0, X = 4.0} -- this is OK, because norm' is polymorphic

96

96

}}}

97

97

98

The more complex systems support first class labels. Here is an example using the Type Families system: