@ -124,7 +124,7 @@ let f_gadt : type t. t c -> t -> int =

## Small riddles

#### How to write the `val equal : unit -> unit -> bool` function ?

<h4>How to write the <codeclass="language-ocaml">val equal : unit -> unit -> bool</code> function ?</h4>

When I teach OCaml to some people, after some time, I like to ask them this question. Here are the answer I usually get.

@ -133,7 +133,7 @@ When I teach OCaml to some people, after some time, I like to ask them this ques

<codeclass="language-ocaml">let equal x y = if x = y then true else false</code>

</details>

Come on ! First you should write it `let equal x y = x = y`. But more importantly, there's no need to test for equality, there's only one inhabitant for the `unit` type, so it's always `true`. Try again !

Come on ! First you should write it <codeclass="language-ocaml">let equal x y = x = y</code>. But more importantly, there's no need to test for equality, there's only one inhabitant for the `unit` type, so it's always `true`. Try again !

<details>

<summary>Second answer:</summary>

@ -147,7 +147,7 @@ Well, `dune` will make the compiler shrill because of unused variables. Let's tr

Better, but this has the signature `val equal : 'a -> 'b -> bool` (and the previous answer too). How can we fix this ?

Better, but this has the signature <codeclass="language-ocaml">val equal : 'a -> 'b -> bool</code> (and the previous answer too). How can we fix this ?