> In Haskell, traditionally we would fix this with a newtype declaration which wraps the type. We could find a newtype NonEmptyList and a newtype FiniteFloat and then say that we actually wanted a NonEmptyList[FiniteFloat] there. […] But why should we bother? Especially if we’re only using these in one test, we’re not actually interested in these types at all, and it just adds a whole bunch of syntactic noise when you could just pass the data generators directly.
Did you know it's one function call to change your NonEmptyList FiniteFloat into [Float]? It's called coerce. There's very little extra syntactic baggage.
And you know what, carrying data generators around is a bad idea. It forces you to think about how you want the random data to be generated, and not what the random data should look like.
Did you know it's one function call to change your NonEmptyList FiniteFloat into [Float]? It's called coerce. There's very little extra syntactic baggage.
And you know what, carrying data generators around is a bad idea. It forces you to think about how you want the random data to be generated, and not what the random data should look like.