I'm having the following problem in sml:
i want to create a set using the IntListSet
signature but instead of int
I want to use large int
.
Is there any way to fix this?
Thank you, awaiting for your answer .
You can use the ListSetFn
functor. From the documentation, you will find:
functor ListSetFn (ORD_KEY) : ORD_SET
This says that ListSetFn
is a functor that takes a structure satisfying the ORD_KEY
signature, which you can find in the documentation as:
type ord_key
val compare : (ord_key * ord_key) -> order
So basically, you need to create a structure that satisfies the ORD_KEY
signature, such as:
structure LargeIntKey : ORD_KEY =
struct
type ord_key = LargeInt.int
val compare = LargeInt.compare
end
And then you can create a LargeInt
instance of the ListSetFn
functor by doing:
structure LargeIntSet = ListSetFn(LargeIntKey)