Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hm. I'd agree there. It's always very important to write a decent Arbitrary typeclass instance. I've never found it terribly hard -- it's always exactly as hard as trying to decide what the potential input space you support should be -- and I don't expect it to be in Erlang either.

The difference is that once you start combining Arbitrary instances you need to have strict, careful control over these input spaces, something "trivial" when you're abusing the Hindley-Miller type system. I've never written QC tests in Erlang, let alone at higher levels of complexity, but I can only imagine that it's a short while before you're forced to manually do inference a static type system auto-infers.



I don't think Hughes is talking about writing the implementation of the generators. He's talking about writing then down in your tests, e.g.

    ?FORALL(N,int(),
    ?FORALL(M,int(),
      N+M==M+N)).
In Haskell you can specify the `int()`'s in the type instead of in the code. What I think Hughes is saying is that for real world testing scenarios, the standard type generators aren't fine grained enough. For example, you need to specify `positiveint()`, or `elementinlist(L)`.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: