Bogdanp / rackcheck

A property-based testing library for Racket.
28 stars 7 forks source link

Typing #11

Open Lazerbeak12345 opened 1 year ago

Lazerbeak12345 commented 1 year ago

I was thinking about adding typed/racket support to this library. There's a lot of ways to do this. Here's some ways that look simple enough to me.

Alternatively (or even in parallel?), one could gradually type the library and get it to work that way.

What do you think?

Bogdanp commented 1 year ago

I think that would be great. Adding a rackcheck-typed package to this repository would be the way to go. That way, rackcheck-lib won't have to depend on typed-racket for the folks that don't use typed racket.

Lazerbeak12345 commented 1 year ago

Ok, so I started work on this then discovered that since part of the public api relies on racket/stream (which has not yet been typed) that library will have to be typed first. https://github.com/racket/typed-racket/issues/970

Lazerbeak12345 commented 1 year ago

I've started work on typing that upstream thing. Feel free to leave feedback lol.

Lazerbeak12345 commented 1 year ago

Me and several other discord users talked about this in the racket discord. https://discord.com/channels/571040468092321801/993032505127088209/1070776863900844102

I'll just use the Sequenceof type in place of Streamof for now.

Lazerbeak12345 commented 1 year ago

I've determined that this typed api might not be very useful, due to severe limitations of typed/racket.

Without looking at tools outside of the core package (which may prove useful), it is impossible to add type parameters to structs defined in untyped racket (currently). There doesn't seem to be any plan to change this - and since your great API makes use of structs in the way it does, I would normally just parameterize the type.

I'll be taking a step back from this for now. Perhaps I'll come up with another approach.

Bogdanp commented 1 year ago

No worries and thanks for trying! Sorry I couldn't be of more help, but I don't really use typed racket.