You are looking at historical revision 31521 of this page. It may differ significantly from its current revision.
type-extensions
Description
Miscellaneous extensions for the CHICKEN type system.
Requirements
Usage
type-extensions should be loaded as a compiler extension with the -extend (or -X) flag to csc:
$ csc -extend type-extensions <file>
API
[syntax] (define-type (name var ...) type)Defines a complex type alias that can be used in place of type. In each usage, instances of each var in type will be replaced by the corresponding forms in (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.
Author
License
Copyright (c) 2014, 3-Clause BSD.