2
아래와 같이 비교 세트를 쓰고 싶습니다.sml의 타입 클래스를 달성하는 방법
signature COMPARABLE_SET=
sig
type 'a set
val empty: 'a set
val insert: 'a * 'a set -> 'a set
val member: 'a * 'a set -> bool
end
난 비교 가능하도록 설정 유형 '의 요소를 제한 할 필요가 (종류와 기능이있다 :이 'a * 'a -> order
).
어떻게 구현합니까?
SML/NJ 라이브러리의'ORD_SET' 서명이 어떻게 정의되는지보십시오 : http://www.smlnj.org/doc/smlnj-lib/Manual/ord-set.html#ORD_SET:SIG : SPEC –
또한 원하는 것은 SML로 안전하게 작성할 수 없습니다. 이 주제와 관련된 두 개의 블로그 게시물 (http://igstan.ro/posts/2017-04-08-a-safe-type-indexed-set-for-standard-ml.html 및 http : //)을 작성했습니다. igstan.ro/posts/2017-04-12-a-safe-type-indexed-set-for-standard-ml-errata.html. –