haskell-hedgehog icon indicating copy to clipboard operation
haskell-hedgehog copied to clipboard

Port hedgehog to PureScript

Open JordanMartinez opened this issue 5 years ago • 9 comments

I'm wondering how much interest there would be in porting this library to PureScript. I would like to help. I'm familiar with PureScript, but not so much with Haskell.

JordanMartinez avatar Apr 10 '20 04:04 JordanMartinez

Historically, hedgehog was called jack :wink:. Make sure you look into @jacobstanley's purescript-jack in case it helps you get up to speed, but don't use it as a skeleton for purescript-hedgehog.

A few things that aren't on the jack repo:

  • SplitMix
  • Range
  • Perf improvements (e.g. in the Shrink module)
  • Additions in the Gen module
  • and others that I can't currently think off the top of my head

Once your port is in a usable state, and of fine quality (e.g. see our STYLE_GUIDE), it could be moved to @hedgehogqa org (if you want to, of course).

moodmosaic avatar Apr 10 '20 07:04 moodmosaic

Thanks for the response @moodmosaic. I was also asking how much support I could expect when making this port and what kind of support that would be. Is it none at all whatsoever? If so, that's fine, but I'd like to have that clarified.

Regardless, are there any links (even outdated ones) that explain the internals of hedgehog, how it works, and why it works that way?

JordanMartinez avatar Apr 12 '20 15:04 JordanMartinez

I was also asking how much support I could expect when making this port and what kind of support that would be.

I'm not sure if there's a precise answer for this. :confused:

  • Discovering a bug during the conversion process means opening a GitHub issue
  • General questions for parts of the code you don't fully understand can be on Slack(?)

moodmosaic avatar Apr 14 '20 08:04 moodmosaic

General questions for parts of the code you don't fully understand can be on Slack(?)

That'll work!

There's a few things that exist in Haskell that don't yet exist in PureScript (e.g. TemplateHaskell) and other things like that. So, I will likely ask how and why thing work that way in Haskell to see whether we can do the same in PureScript or what other tradeoffs we'll have to make due to JavaScript limiting us in various ways.

So far, the work I've done has been relatively simple and straightforward. However, I'm now starting to get into the meat of the library.

JordanMartinez avatar Apr 15 '20 00:04 JordanMartinez

Just wanted to give an update on this rather than leaving this be.

I'm refocusing my time on other projects for the time being. While this is something I want to do at some point, there are other things I should be doing at this stage of my life.

JordanMartinez avatar Jun 03 '20 20:06 JordanMartinez

@JordanMartinez Curious if you got to a usable point with your port and whether there is any advantage in sharing the code?

tmcgilchrist avatar Jun 23 '20 06:06 tmcgilchrist

@tmcgilchrist No, not to a usable state. See this repo's purescriptPort branch for where I stopped.

I graphed the module dependency within the project. I'll explain what the colors mean after this image. purescript-hedgehog-module-graph

Color Meaning
Blue Finshed
Green/Yellow? Ones I was planning to port next
Red Modules that I knew would be harder/impossible to port
Orange No meaning

Syntax changes were relatively straight forward (though tedious). I had some difficult understanding how to port over Num related functions because PureScript only has Ints and Numbers. I also wasn't sure how I would handle the asynchronous exceptions and call stack that Haskell could do but which PureScript AFAIK can't do. Lastly, one of the libraries that hedgehog depends upon to pretty print things doesn't yet exist in PureScript.

JordanMartinez avatar Jun 23 '20 13:06 JordanMartinez

@JordanMartinez, how was the module dependency graph created?

moodmosaic avatar Jun 24 '20 14:06 moodmosaic

@moodmosaic Manually while using yEd to do it and then using its auto-layout feature.

JordanMartinez avatar Jun 24 '20 19:06 JordanMartinez