@@ -106,7 +106,8 @@ We implemented functions `replaceTokenInRow` and `replaceTokenInField`. Reimplem

5) Now that we know about polymorphic structures, let us redefine the `Field` type as follows.

>typeFieldtoken=[[token]]

>-- type Field token = [[token]]

>typeFieldtoken=[]([]token)

Here, instead of reusing the `Token`s defined in the last exercise, we use a type parameter in order to use the type synonym `Field` with abritrary values.

Reimplement the function `replaceTokenInField` once more using the predefined higher-order function `map` that works an arbitrary lists; note that for this concrete example, we reuse `Ex.Token`.

...

...

@@ -116,12 +117,15 @@ Reimplement the function `replaceTokenInField` once more using the predefined hi

6) We also redefined `CoordMap` using polymorphic lists and pairs.

>typeCoord=(Int,Int)

>typeCoords=[Coord]

>-- type Coord = (Int,Int)

>typeCoord=(,)IntInt

>-- type Coords = [Coord]

>typeCoords=[]Coord

Based on this type synonym we define a type to represent `Coordinate`s as keys and arbitrary tokens as values in order to describe the positions of such tokens. A list of such pairs describes a figure.

>typeFiguretoken=[(Coord,token)]

>-- type Figure token = [(Coord, token)]

>typeFiguretoken=[]((,)Coordtoken)

Here, we again use a type parameter `token` to use `Figure` with an abitrary type.

Using this type, we can visualise, for example, the following figure.