[plt-scheme] Help making a unit from a module

From: Danny Yoo (dyoo at hkn.eecs.berkeley.edu)
Date: Sun Dec 24 23:49:42 EST 2006


> However, my attempts at getting the unit in a module have been frustrating.
> This what I have, which does not work:
>
[code cut]

Hi Kyle,

Sorry for the late response!  I see that the toplevel expressions that you 
did were:

     (require pp)
     (define data 'success)
     (invoke-unit pp@ (import pp^))

Did you require pp-sig and unit.ss in your toplevel, though?  I didn't see 
those.  Otherwise, as far as I can tell, everything else looks fine, and I 
see the results that you'd expect.  Here's a transcript:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mithril:~ dyoo$ mzscheme
Welcome to MzScheme version 369.1, Copyright (c) 2004-2006 PLT Scheme Inc.
> (module pp-sig mzscheme
     (provide pp^)
     (require (lib "unit.ss"))
     (define data #f)
     (define-signature pp^ (data)))
>
> (module pp (lib "a-unit.ss")
     (require pp-sig)
     (import pp^)
     (export)

     (define (pp x)
       (display x)
       (newline))
     (pp data))
>
> (require pp)
> (require pp-sig)
> (require (lib "unit.ss"))
>
> (define data 'success!)
> (invoke-unit pp@ (import pp^))
success!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



Happy holidays!


Posted on the users mailing list.