Skip to content

Instantly share code, notes, and snippets.

@Glorp
Created January 6, 2016 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Glorp/c36bcb3af0d8586ec733 to your computer and use it in GitHub Desktop.
Save Glorp/c36bcb3af0d8586ec733 to your computer and use it in GitHub Desktop.
seems to work
#lang racket
(module a-sig racket
(provide a^)
(define-signature a^
(a)))
(module b-sig racket
(provide b^)
(define-signature b^
(b)))
(module a-impl racket
(require (submod ".." a-sig)
(submod ".." b-sig))
(provide a@)
(define-unit a@
(import b^)
(export a^)
(define (a x)
(if x 'a (b x)))))
(module b-impl racket
(require (submod ".." a-sig)
(submod ".." b-sig))
(provide b@)
(define-unit b@
(import a^)
(export b^)
(define (b x)
(if x (a x) 'b))))
(require 'a-sig
'a-impl
'b-sig
'b-impl)
(define-compound-unit/infer ab@
(import)
(export a^
b^)
(link a@
b@))
(define-values/invoke-unit/infer ab@)
(a 1)
(a #f)
(b 1)
(b #f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment