Search code examples
smlsmlnj

Unbound Type Constructor for datatype


if I had initialized a datatype dataype dd = DAT of int*int, how do I initialize a type of that for a function.


Solution

  • The type is called Cint, not CI, so you have to use Cint in places where a type is required:

    fun cadd(a:Cint, b:Cint) =
    

    Or you can use a different syntax, involving a pattern, if you want to keep using the datatype constructor CI:

    fun cadd(a as CI _, b as CI _) =