6 ms·
“head” has the type: <T> (List<T> -> Optional<T>) (“For any type T, function from list of T to optional T.”) So assuming “xs” is a list, “xs head” is eit
by evincarofautumn 8y ago
“head” has the type:
<T> (List<T> -> Optional<T>)
(“For any type T, function from list of T to optional T.”)
So assuming “xs” is a list, “xs head” is either a full Optional (“some”) containing the first element of the list, or an empty Optional (“none”) if the list was empty—typed, of course, according to the element type of the input list, so if “xs” has type “List<Int32>” then “xs head” has type “Optional<Int32>”.