home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / type / pattern-binding.scm < prev    next >
Encoding:
Text File  |  1994-09-27  |  1.7 KB  |  30 lines  |  [TEXT/CCL2]

  1. ? (single-fun-def-args (car defs)))
  2.      (not (eq? (var-signature (var-ref-var (var-pat-var lhs))) '#f)))))
  3.  
  4. (define (do-pattern-binding-rule decls necessary-tyvars ng-list)
  5.   (setf ng-list (append necessary-tyvars ng-list))
  6.   (find-exported-pattern-bindings decls)
  7.   ng-list)
  8.  
  9. (define (find-exported-pattern-bindings decls)
  10.   (dolist (decl decls)
  11.     (dolist (var-ref (collect-pattern-vars (valdef-lhs decl)))
  12.      (let ((var (var-ref-var var-ref)))
  13.       (when (def-exported? var)
  14.     (recoverable-error 'exported-pattern-binding
  15. "Monomorphism restriction violation (see section 4.5.4, rule 2 in the report)~%~
  16.  the overloaded variable ~A cannot be exported"
  17.         var-ref))
  18.       (when (not (eq? (var-signature var) '#f))
  19.          (recoverable-error 'entire-group-needs-signature
  20.    "A group of mutually recursive overloaded definitions, ~%~A~%~
  21.     must have signatures for every definition if any is to have a signature~%~
  22.     Signature for ~A ignored (see 4.5.4 in the report)."
  23.             (gather-all-group-vars decls) var))))))
  24.  
  25. (define (gather-all-group-vars decls)
  26.   (let ((res '()))
  27.     (dolist (decl decls)
  28.       (setf res (append res (collect-pattern-vars (valdef-lhs decl)))))
  29.     res))
  30.