Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 721 Bytes

5023.md

File metadata and controls

32 lines (22 loc) · 721 Bytes

5023

A record type couldn't be fully resolved, due to the use of a ... pattern row with insufficient surrounding context.

fun getX {x, ...} = x
(** + cannot resolve `...` in record type: `{ x : _, ... }` *)

SML lacks row polymorphism, so the above example function does not typecheck.

This error may arise when using # selectors.

fun addFooBar x = #foo x + #bar x
(** + cannot resolve `...` in record type: `{ bar : <num>, foo : <num>, ... }` *)

To fix

Consider adding a type annotation.

type t = {x : int, y : bool, z : string}
fun getX ({x, ...} : t) = x

An alternative would be to avoid ... pattern rows altogether.

fun addFooBar {foo, bar} = foo + bar