This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
Miscellaneous extensions for CHICKEN's type system.
The source for this egg is available here.
type-extensions should be loaded as a compiler extension with the -extend (or -X) flag to csc:
$ csc -extend type-extensions <file>
- (define-type name)syntax
Shorthand for (define-type name (struct name)).
- (define-type (name var ...) type)syntax
Defines a complex type alias that can be used in place of type. In each usage, all instances of var in type will be replaced by the corresponding form from (name var ...).
(define-type (pair-of a) (pair a a)) (: pair (forall (a) (a -> (pair-of a)))) (define (pair x) (cons x x)) (compiler-typecase (pair 1) ((pair-of fixnum) (print '(pair-of fixnum))) (else (print 'else)))
As with CHICKEN's built-in define-type form, type aliases defined inside a module are not visible outside of that module.
- (list . type)syntax
- (list type ...)syntax
A dotted tail or ellipsis at the end of a list type form is shorthand for a sequence of pairs followed by (list-of type).
;; The following types are equivalent: (define-type a (list fixnum float . number)) (define-type b (list fixnum float number ...)) (define-type c (pair fixnum (pair float (list-of number))))