You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
511 B
511 B
Exercises: Parametricity
- As said this is impossible. A function which takes any type and returns that same type can't be anything else. As soon as you choose something else, you pose limitations on the type. E.g.
square x = x * x
requires thatx
can be applied to(*)
, which means it has to be of typeNum
at least.\ - The only possibilies are to return either the first or the second argument.
fst' a1 a2 = a1
snd' a1 a2 = a2
- Here there is only one possiblity:
snd'' a b = b
.