;;; Alef Lazily Evaluates Functions ;;; (C) 2008-2009 Dr. Gergo ERDI (in-package :alef) (deftype typedesc () 'tree) (deftype requirement () 'list) (defun type-fun-p (type) (declare (typedesc type)) (and (consp type) (eq (car type) 'fun))) (defun type-supertype (type) (declare (typedesc type)) (typecase type (cons (car type)) (atom type))) (defun make-typevar () (gensym "T")) (defclass signature () ((type :type typedesc :initarg :type :reader signature-type) (requirements :type list :initarg :reqs :reader signature-reqs))) (defun make-signature (type &optional reqs) (make-instance 'signature :type type :reqs reqs)) (defclass typing () ((signature :initarg :signature :type signature :reader typing-signature) (equations :initarg :equations :type list :reader typing-equations))) (defun make-typing (signature &optional equations) (declare (signature signature)) (make-instance 'typing :signature signature :equations equations)) (defclass typeinfo () ((symbol :initarg :symbol :reader typeinfo-symbol :type symbol) (params :initarg :params :reader typeinfo-params :type list) (constructors :initform (list) :accessor typeinfo-constructors :type list))) (defun make-typeinfo (symbol params) (make-instance 'typeinfo :symbol symbol :params params)) (defclass constructor-info () ((symbol :initarg :symbol :reader constructor-symbol :type symbol) (supertype :initarg :supertype :reader constructor-type :type symbol) (signature :initarg :signature :reader constructor-signature :type signature))) (defun make-constructor (symbol supertype signature) (make-instance 'constructor-info :symbol symbol :supertype supertype :signature signature))