Reputation: 31
I'm trying to make a type (int option list) list variable.
let blah :(int option list) list = [Some 30 ; Some 77] :: [Some 2 ; Some 3] ;;
However, this does not type check. I guess I'm just really lost on the syntax.
Upvotes: 1
Views: 2059
Reputation: 9377
You almost got it:
let blah : (int option list) list = [Some 30 ; Some 77]::[[Some 2] ; [Some 3]]
Or, more readably:
let blah = [[Some 30; Some 77]; [Some 2]; [Some 3]]
The type problem is in the application of ::
: you have different types for the left hand side and the elements of the right hand side.
Upvotes: 6