타입 클래스(type class) 또는 형 클래스컴퓨터 과학에서 임시 다형성을 지원하는 유형 시스템 구성이다. 이는 매개변수적으로 다형성 유형의 유형 변수에 제약 조건을 추가함으로써 달성된다. 이러한 제약 조건에는 일반적으로 타입 클래스 T와 유형 변수 a가 포함되며, 이는 T와 관련된 오버로드된 작업을 지원하는 멤버가 있는 유형으로만 a를 인스턴스화할 수 있음을 의미한다.

타입 클래스는 필립 왈더(Philip Wadler)와 스티븐 블롯(Stephen Blott)가 표준 ML의 "eqtypes" 확장으로 처음 제안한 후 하스켈 프로그래밍 언어로 처음 구현되었으며[1][2], 원래는 오버로드된 산술 및 항등 연산자를 원칙적인 방식으로 구현하는 방법으로 고안되었다.[3][2] 표준 ML의 "eqtypes"과 달리 하스켈의 타입 클래스를 사용하여 항등 연산자를 오버로드하는 경우 컴파일러 프런트엔드나 기본 유형 시스템을 광범위하게 수정할 필요가 없다.[4]

같이 보기

편집

각주

편집
  1. Morris, John G. (2013). 《Type Classes and Instance Chains: A Relational Approach》 (PDF) (PhD). Department of Computer Science, Portland State University. doi:10.15760/etd.1010. 
  2. Wadler, P.; Blott, S. (1989). 〈How to make ad-hoc polymorphism less ad hoc〉. 《Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '89)》. Association for Computing Machinery. 60–76쪽. doi:10.1145/75277.75283. ISBN 0897912942. S2CID 15327197. 
  3. Kaes, Stefan (March 1988). 〈Parametric overloading in polymorphic programming languages〉. 《Proc. 2nd European Symposium on Programming Languages》. doi:10.1007/3-540-19027-9_9. 
  4. Appel, A.W.; MacQueen, D.B. (1991). 〈Standard ML of New Jersey〉. Maluszyński, J.; Wirsing, M. 《Programming Language Implementation and Logic Programming. PLILP 1991》. Lecture Notes in Computer Science 528. Springer. 1–13쪽. CiteSeerX 10.1.1.55.9444. doi:10.1007/3-540-54444-5_83. ISBN 3-540-54444-5. 

외부 링크

편집