Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2019-05-17 Thread Ben Greenman
What happens if you provide the data structure from Typed Racket and require it in an untyped module? On 5/17/19, bruno cuconato wrote: > hi, > > I'm trying to use a data structure defined in a typed racket module in my > untyped code. > > I'm want it to be accessible from a generic interface,

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2019-05-17 Thread bruno cuconato
hi, I'm trying to use a data structure defined in a typed racket module in my untyped code. I'm want it to be accessible from a generic interface, so I'm using `define-generics`'s #:fast-defaults for dispatching to the proper methods (this might not be the best practice though, and if so I

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-08-08 Thread Sam Tobin-Hochstadt
One other suggestion: you can use `define-predicate` in a Typed Racket module to create a predicate for any type that can be checked immediately. So ``` (define-predicate dist? (Discrete-Dist Your-Type-Here)) ``` should define the predicate you want. Sam On Fri, Jul 28, 2017 at 10:23 AM, James

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-31 Thread Matthias Felleisen
> On Jul 31, 2017, at 5:27 AM, James Geddes wrote: > > > Matthias, > > Thank you, that's really helpful, both for letting me know I'm not being an > idiot (always welcome!) and for the example code, which makes me realise I > should learn about exceptions next. > >

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-31 Thread James Geddes
Matthias, Thank you, that's really helpful, both for letting me know I'm not being an idiot (always welcome!) and for the example code, which makes me realise I should learn about exceptions next. Many thanks again, James --- James Geddes -- You received this

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-28 Thread Matthias Felleisen
After some poking around, here is what I can offer: #lang racket (module predicates racket (provide discrete-dist-thing?) ;; - ;; dependencies (require math/distributions) ;; - ;; implementation (define

Re: [racket-users] Help: How to check a typed/racket type in an untyped Racket contract?

2017-07-28 Thread Matthias Felleisen
> On Jul 28, 2017, at 11:23 AM, James Geddes wrote: > > This is likely a typed-untyped interface newbie question. > > Briefly, how can I write a contract that asserts that some value has a type > that is defined in an imported typed/racket library? > > In more detail, I