[racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-16 Thread mailoo
Hello, I'm new to racket, and even more with typed/racket. I play a little with the "Any" type (due to 'dynamic-require' which return Any), and I'm not able to cast them back in a function. I (over) simplify my question with this little program : ``` (: p Any) (define (p i) (displayln i))

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-16 Thread Greg Hendershott
Maybe do you want `require/typed`? See: https://docs.racket-lang.org/ts-guide/typed-untyped-interaction.html#%28part._.Using_.Untyped_.Code_from_.Typed_.Code%29 -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-16 Thread Matthias Felleisen
Have you considered organizing your program as follows: #lang racket (module a racket (provide f) (define (f x) 10)) (module b racket (provide g) (define g (dynamic-require '(submod "foo.rkt" a) 'f))) (module c typed/racket (require/typed (submod ".." b) [g (-> Integer Integer)])

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-16 Thread mailoo
Hello, First thank Greg and Mathias for looking at my problem. And yes, the proposed solution is working! I didn't think at all by putting a "module in the middle", to by-pass my cast operation. Thank you! Denis On 04/16/2018 04:01 PM, Matthias Felleisen wrote: Have you considered organizi

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-17 Thread Alex Knauth
This is interesting. The `Any` type in Typed Racket includes values that may have higher-order "original" types. For example, it may have originally been a typed function (-> Fixnum Fixnum) or (-> String Boolean), such that if you call it without a contract guarding it, it should be an error. Th

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-20 Thread mailoo
Hello, I continue my work with Typed/Racket and Racket, and I now have another problem, with the same error. I try to use in untyped racket a typed async-channel of type Any, and I'm not able to use the higher-order value from this channel. Here is an example code that show this problem : ```

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-20 Thread mailoo
Unfortunatly, not. I'm building a framework were the user will send data over the async-channel, so I didn't know the type in advance, and cannot specify more the async-channel... On 04/20/2018 02:50 PM, Sam Tobin-Hochstadt wrote: Can you give a more specific type to what you send on the chann

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-20 Thread Matthias Felleisen
Can you move the communication into an untyped submodule and use external type specs to move the values into the typed world? We could learn from this what’s missing from Typed Racket. > On Apr 20, 2018, at 10:14 AM, mailoo wrote: > > Unfortunatly, not. > I'm building a framework were the

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-20 Thread Sam Tobin-Hochstadt
In that case, which side is not typed? If the user side isn't typed, then you can _read_ things of type `Any` from the channel just fine. Sam On Fri, Apr 20, 2018 at 10:14 AM, mailoo wrote: > Unfortunatly, not. > I'm building a framework were the user will send data over the > async-channel, so

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-20 Thread mailoo
The untyped world will read and write... The typed world surround this actions (async-channel-put and async-channel-get) by other things. I want my framework Typed and using it untyped, but it seems hard to manage! But beside, thank you for looking at my problem! On 04/20/2018 05:41 PM, Sam To

Re: [racket-users] [racket] error : Attempted to use a higher-order value passed as `Any` in untyped code:

2018-04-20 Thread stewart mackenzie
Probably better to revert back to untyped racket for the meantime... -- 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. F