Here is a small modification of your program that I think does what you want,
but I might not understand your question:
#lang racket
(define-signature x^ (a b c))
; (define-signature y^ (b))
; (define-signature z^ (c))
(define-signature f^ (f))
(define-unit u@
(import x^)
(export f^)
(define (f q) (+ a b c q)))
;; a transformer on units implementing f^
(define-unit double@
(import (rename f^ (g f)))
(export f^)
(define (f x) (g (g x
(define-unit xyz@
(import)
(export x^)
(define-values (a b c) (values 1 2 3)))
(define-values/invoke-unit/infer
(link xyz@ u@))
(define (double-functor some-unit-with-signature-f^)
(compound-unit
(export)
(import)
(link
[((xyz : x^)) xyz@]
[((u : f^)) u@ xyz]
[((d : f^)) some-unit-with-signature-f^ u])))
(double-functor double@)
On Mar 2, 2016, at 11:07 PM, David Van Horn wrote:
> Hello,
>
> I'm trying to do something like a unit "mixin", but have gotten stuck.
>
> Here's a sketch of what I'd like:
>
> #lang racket
>
> (define-signature x^ (a))
> (define-signature y^ (b))
> (define-signature z^ (c))
>
> (define-signature f^ (f))
>
> (define-unit u@
> (import x^ y^ z^)
> (export f^)
> (define (f q) (+ a b c q)))
>
> ;; a transformer on units implementing f^
> (define-unit double@
> (import (rename f^ (g f)))
> (export f^)
> (define (f x) (g (g x
>
> (define-unit xyz@
> (import)
> (export x^ y^ z^)
> (define-values (a b c) (values 1 2 3)))
>
> (define-values/invoke-unit/infer
> (link xyz@ u@))
>
> I'd like to be able to do something in that last definition that is
> essentially double@ "applied to" u@. Is there some way to accomplish
> that? In particular, some way that doesn't require enumerating the
> imports of u@?
>
> Thanks,
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.