<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Would it help to wrap one of them (in this case WireVec) in a structure like this:</div><div><div>#lang typed/racket</div><div>(define-type Wire (U (Promise Wire) Symbol))</div><div>(define-type Wire-List (U (Promise Wire-List) (Listof Wire)))</div><div>(struct wire-vec ([wires : Wire-List]) #:transparent)</div><div>(define-type WireVec wire-vec)</div><div><br></div><div>;; dispatch based on type</div><div>(: Not (case-> (Wire -> Wire)</div><div>               (WireVec -> WireVec)))</div><div>(define (Not wire*)</div><div>  (if (wire-vec? wire*)</div><div>      (Not-wirevec wire*)</div><div>      (Not-wire wire*)))</div><div><br></div><div>(: Not-wire (Wire -> Wire))</div><div>(define (Not-wire w)</div><div>  (displayln "received wire")</div><div>  w)</div><div><br></div><div>(: Not-wirevec (WireVec -> WireVec))</div><div>(define (Not-wirevec w)</div><div>  (displayln "received wirevec")</div><div>  w)</div><div><br></div><div>;; test</div><div>(Not 'my-wire)</div><div>(Not (wire-vec (list 'a 'b 'c)))</div><div><br></div><div>;;; printed results are</div><div>;received wire</div><div>;'my-wire</div><div>;received wirevec</div><div>;(wire-vec '(a b c))</div></div><div><br></div><br><div><div>On Jan 23, 2015, at 11:41 AM, Luke Whittlesey <<a href="mailto:luke.whittlesey@gmail.com">luke.whittlesey@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""></span>
That's only a guess at what `Not` is supposed to do, though. If you need to make a decision without first forcing the promise, you'll need to use different types.<span class=""><font color="#888888"></font></span></blockquote><div><br></div><div>I'm playing around with describing circuits using Racket and using TR to type check my ports. Unfortunately I do have to make a decision before forcing the promise, just because in my current design I use nested letrec forms and can't guarantee that the promise is ready. `Not` is just a simple example of something that has a different behavior depending if the input is a single wire or a bundle of wires, but the input could also be a promise that forces to either a wire or a bundle.<br></div><div>Ususally when I get myself into a corner and there's not an easy way out, I need to rethink my approach (or goals). <br></div><div>Thanks for your suggestions.<br><br></div><div>-Luke<br></div></div></div></div>
____________________<br>  Racket Users list:<br>  <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br></blockquote></div><br></body></html>