[plt-scheme] Units And Contracts In Bed(ed) Together
Is there a way to combine contracts with unit sigs?
;; Amazon S3 API
(define-signature s3^
(list-buckets (-> aws-credentials? any))
(create-bucket (-> aws-credentials? s3-bucket? any))
(delete-bucket (-> aws-credentials? s3-bucket? any))
(put-object (-> aws-credentials? bytes? s3-resource? any))
(put-file-object (-> aws-credentials? path? s3-resource? any))
(head-object (-> aws-credentials? s3-resource? any))
(get-object (-> aws-credentials? s3-resource? bytes?))
(delete-object (-> aws-credentials? s3-resource? any))
(list-bucket-objects (-> aws-credentials? s3-bucket? s3-key? string?
number? any)))
Then given a unit
;; my naive s3 implementation
(define s3@
(unit
(import ...^)
(export s3^)
(define list-buckets ...)
(define create-bucket ...)))
The idea would be to attach the signature providing contracts to the
implementing procedures defined in the unit when the unit is invoked.