elm-explorations / test

Write unit and fuzz tests for Elm code.
https://package.elm-lang.org/packages/elm-explorations/test/latest
BSD 3-Clause "New" or "Revised" License
237 stars 39 forks source link

Simplify.lazylist cannot be used #67

Closed harrysarson closed 5 years ago

harrysarson commented 5 years ago

https://package.elm-lang.org/packages/elm-explorations/test/latest/Shrink#lazylist

The function Simplify.lazylist has this type signature (note it takes a LazyList as an argument):

lazylist : Shrinker a -> LazyList a -> LazyList (LazyList a)

However, LazyList is not exposed by this package so there is no way that a user can get their hands on a LazyList to pass to Simplify.lazylist. Therefore, (unless I am wrong - entirely possible) there is no way to call this function.

Either:

Refs: #66 cc: @tmohme

mgold commented 5 years ago

Adding major release blocker keyword because of the potential breaking API change.

tmohme commented 5 years ago

@harrysarson
With the following snippet I'm able to use the lazylist function:

import Shrink

--f : Int -> LazyList (LazyList Int)
f valueToShrink = 
    Shrink.lazylist Shrink.int (Shrink.int valueToShrink)

But . . .

harrysarson commented 5 years ago

Ah nice 1.

the example only compiles if you don't use type annotations

I have never come across this before, very interesting.

mgold commented 5 years ago

The purpose of this function is to simplify lazy lists, and in 0.19 there is not a standard implementation of lazy, or lazy lists. The function is used to implement making shrinkers from lists or arrays, but I think we should not expose it.