Γενικευμένος αλγεβρικός τύπος δεδομένων
|
Ιστορία
[Επεξεργασία | επεξεργασία κώδικα]Εφαρμογές
[Επεξεργασία | επεξεργασία κώδικα]Αφηρημένη σύνταξη υψηλότερης τάξης
[Επεξεργασία | επεξεργασία κώδικα]data Lam :: * -> * where
Lift :: a -> Lam a
Tup :: Lam a -> Lam b -> Lam (a, b)
Lam :: (Lam a -> Lam b) -> Lam (a -> b)
App :: Lam (a -> b) -> Lam a -> Lam b
Fix :: Lam (a -> a) -> Lam a
eval :: Lam t -> t
eval (Lift v) = v
eval (Tup e1 e2) = (eval e1, eval e2)
eval (Lam f) = \x -> eval (f (Lift x))
eval (App e1 e2) = (eval e1) (eval e2)
eval (Fix f) = (eval f) (eval (Fix f))
fact = Fix (Lam (\f -> Lam (\y -> Lift (if eval y == 0 then 1 else eval y * (eval f) (eval y - 1)))))
App (Lam (\x -> Lam (\y -> App x y))) (Lift True)
Σημειώσεις
[Επεξεργασία | επεξεργασία κώδικα]
Επιπλέον Υλικό
[Επεξεργασία | επεξεργασία κώδικα]- Εφαρμογές
- Augustsson, Lennart; Petersson, Kent (September 1994). Silly type families. http://web.cecs.pdx.edu/~sheard/papers/silly.pdf.
- Cheney, James; Hinze, Ralf (2003). «First-Class Phantom Types». Technical Report CUCIS TR2003-1901 (Cornell University). Πρότυπο:Hdl.
- Xi, Hongwei; Chen, Chiyan; Chen, Gang (2003). «Guarded Recursive Datatype Constructors». Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'03) (ACM Press): 224–235. doi: .
- Sheard, Tim; Pasalic, Emir (2004). «Meta-programming with built-in type equality». Proceedings of the Fourth International Workshop on Logical Frameworks and Meta-languages (LFM'04), Cork. doi: .
- Semantics
- Patricia Johann and Neil Ghani (2008). "Foundations for Structured Programming with GADTs".
- Arie Middelkoop, Atze Dijkstra and S. Doaitse Swierstra (2011). "A lean specification for GADTs: system F with first-class equality proofs". Higher-Order and Symbolic Computation.
- Επανακατασκευή τύπων
- Peyton Jones, Simon; Washburn, Geoffrey; Weirich, Stephanie (2004). «Wobbly types: type inference for generalised algebraic data types». Technical Report MS-CIS-05-25 (University of Pennsylvania). http://research.microsoft.com/en-us/um/people/simonpj/papers/gadt/MS-CIS-05-26.pdf.
- Peyton Jones, Simon; Vytiniotis, Dimitrios; Weirich, Stephanie; Washburn, Geoffrey (2006). «Simple Unification-based Type Inference for GADTs». Proceedings of the ACM International Conference on Functional Programming (ICFP'06), Portland. http://research.microsoft.com/en-us/um/people/simonpj/papers/gadt/gadt-rigid-contexts.pdf.
- Sulzmann, Martin; Wazny, Jeremy; Stuckey, Peter J. (2006). «A Framework for Extended Algebraic Data Types».
Σ τ ο : Hagiya, M.; Wadler, P., επιμ. 8th International Symposium on Functional and Logic Programming (FLOPS 2006). Lecture Notes in Computer Science. 3945, pp. 46–64. - Schrijvers, Tom; Peyton Jones, Simon; Sulzmann, Martin; Vytiniotis, Dimitrios (2009). «Complete and Decidable Type Inference for GADTs». Proceedings of the ACM International Conference on Functional Programming (ICFP'09), Edinburgh. http://research.microsoft.com/en-us/um/people/simonpj/papers/gadt/implication_constraints.pdf.
- Lin, Chuan-kai (2010). Practical Type Inference for the GADT Type System (PDF) (Διδακτορική διατριβή). Portland State University. Αρχειοθετήθηκε από
τ ο πρωτότυπο (PDF) στις 11 Ιουνίου 2016. Ανακτήθηκε στις 17 Ιουλίου 2012.
- Άλλα
- Andrew Kennedy and Claudio V. Russo. "Generalized algebraic data types and object-oriented programming". In Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications. ACM Press, 2005.
Εξωτερικοί σύνδεσμοι
[Επεξεργασία | επεξεργασία κώδικα]- Generalised Algebraic Datatype Page on the Haskell wiki (Αγγλικά)
- Generalised Algebraic Data Types in the GHC Users' Guide (Αγγλικά)
- Generalized Algebraic Data Types and Object-Oriented Programming (Αγγλικά)
- GADTs – Haskell Prime – Trac (Αγγλικά)
- Papers about type inference for GADTs, bibliography by Simon Peyton Jones (Αγγλικά)
- Type inference with constraints, bibliography by Simon Peyton Jones (Αγγλικά)