3
 let numbers = [1, 5, 6, 12, 52, 25];                                                                
 let state: list((int, bool)) =  numbers |> List.map(n => (n, false));                                                         
 state |> List.map((n, b) => <NumberCard number=n picked=b onClick />);

What could be doing wrong because the type checker says:

 51 ┆
  52 ┆ let elems =
  53 ┆   state |> List.map((n, b) => <NumberCard number=n picked=b onClick />
       );
  54 ┆
  55 ┆ <div className="flex flex-column">

  This has type:
    list(int) => list(bool => React.element)
  But somewhere wanted:
    list((int, bool)) => 'a

  The incompatible parts:
    int
    vs
    (int, bool)

sheki
  • 8,991
  • 13
  • 50
  • 69

1 Answers1

5

You need more parenthesis around your argument:

List.map( ((n, b)) =>

Otherwise, it's a function of 2 arguments, and it gets curried on the first argument with the elements in your state.

Splingush
  • 236
  • 2
  • 5