(index ("define-type" 0) ("define-type" 124) ("list" 803) ("list" 803))
(def (sig (syntax "(define-type name)" (id define-type))) (p "Shorthand for " (tt "(define-type name (struct name))") "."))
(def (sig (syntax "(define-type (name var ...) type)" (id define-type))) (p "Defines a complex type alias that can be used in place of " (tt "type") ". In each usage, all instances of " (tt "var") " in " (tt "type") " will be replaced by the corresponding form from " (tt "(name var ...)") ".") (highlight scheme "(define-type (pair-of a) (pair a a))\n\n(: pair (forall (a) (a -> (pair-of a))))\n(define (pair x) (cons x x))\n\n(compiler-typecase (pair 1)\n  ((pair-of fixnum)\n   (print '(pair-of fixnum)))\n  (else\n   (print 'else)))") (p "As with CHICKEN's built-in " (tt "define-type") " form, type aliases defined inside a module are not visible outside of that module."))
(def (sig (syntax "(list . type)" (id list)) (syntax "(list type ...)" (id list))) (p "A dotted tail or ellipsis at the end of a " (tt "list") " type form is shorthand for a sequence of pairs followed by " (tt "(list-of type)") ".") (highlight scheme ";; The following types are equivalent:\n(define-type a (list fixnum float . number))\n(define-type b (list fixnum float number ...))\n(define-type c (pair fixnum (pair float (list-of number))))"))
