[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-12 Thread Max Goldstein
So let's start with: don't use elm-check, use the new elm-test that includes fuzz testing out of the box. A Fuzzer is basically a producer. A recursive fuzzer is fine in theory. The problem you're running into is that you're m

[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-13 Thread Max Goldstein
Try this implementation: fuzzMusic : Int -> Fuzzer Music fuzzMusic depth = let note = Fuzz.map Note Fuzz.int rest = Fuzz.map Rest Fuzz.int nextLevel = if depth <= 0 then note else fuzzMusi

[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-13 Thread John Watson
Many thanks for the replies, Max and Janis. Yes - exactly - I wanted some sort of size combinator, couldn't find one and just experimented to see what would happen. It would be lovely to have this built in to Fuzz. Max - many thanks for pointing out Fuzz - I wasn't aware of it. I see that elm

[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-13 Thread John Watson
Max, I'm getting frustrated in trying to use the npm-installed elm-test TestRunner. Whereas with version 1.1.0 of elm-test and elm-check, to run my tests I could just use: main = ElmTest.runSuite (Check.Test.evidenceToTest evidence) it's not at all clear to me what I need to do now.

[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-13 Thread Max Goldstein
@John Yes, elm-check was deprecated earlier this will. You almost certainly have an old version of the elm-test shell utility; "elm test --version" should yield 0.17.1. If it doesn't, npm uninstall -g elm-test npm install -g elm-test "elm test init" will create the directory *tests* which will

[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-17 Thread John Watson
@Max Many thanks. I upgraded the elm-test runner and all was fine. Fuzzers do the trick when you limit the depth of recursion as in your example. Just upgraded to 2.0.1 and the shrinker seems to be working much better now. One thing I'd like to have added (if possible) almostEqual : Flo

[elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-17 Thread Max Goldstein
Glad to hear it's working. I opened an issue to add almostIssue so the idea doesn't get lost. -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubsc

Re: [elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-13 Thread Janis Voigtländer
What you do is essentially the standard Haskell QuickCheck way of generating recursive trees, right? http://www.cse.chalmers.se/%7Erjmh/QuickCheck/manual_body.html#16 Except that you bound the number of levels, whereas they bound the size (number of nodes). The “pattern” here would be the sized

Re: [elm-discuss] Re: How do I write an elm-check producer for a recursive data structure?

2016-08-13 Thread Max Goldstein
@Janis > What you do is essentially the standard Haskell QuickCheck way of > generating recursive trees, right? Except that you bound the number of > levels, whereas they bound the size (number of nodes). > Yes, that is accurate. I devised my implementation without knowing about this aspect of