Open gfontenot opened 9 years ago
Hey @gfontenot,
I haven't looked much into generating functions. But theoretically it should be possible (Haskell QC can generate basic functions). Although dynamically generating functions is much more difficult in (Objective-)C. Blocks and Swift's interchangeable function/closures may allow it.
That being said, I haven't really explored more into generative functions. If you do end up trying let me know!
The paper Shrinking and Showing Functions describes Haskell's approach. Unfortunately the best public link I could find is behind the ACM paywall.
@jeffh Any pointers on where to start looking into that?
Thanks @reiddraper for that link. I'll be adding that to my papers reading list.
@gfontenot unfortunately, I don't think I have anything profound.
Haskell's function generation is the only public implementation I know of (docs, source). I'd probably try porting that by reading a Haskell source (my ability is rudimentary at best). Otherwise, Reid's recommendation would be a good read. Getting some basic generation of blocks would probably be where I'd attempt first.
I'm writing a test suite to exercise the Functor, Applicative, and Monadic laws (thoughtbot/runes#2). Right now, I'm only generating the values, but it would be great to be able to generate functions to replace the
append
andprepend
functions that I currently have. Since these laws should hold up for any value and any function, it would be awesome to be able to generate those as well.