Open TheSeamau5 opened 9 years ago
Finally cracked how it would work! Yay!
import Random exposing (Generator)
import Lazy.List exposing (LazyList)
import Shrink exposing (Shrinker)
import RoseTree exposing (RoseTree(..))
type alias Investigator a = Generator (RoseTree a)
shrinkTree : Shrinker a -> a -> RoseTree a
shrinkTree shrink a =
let
list =
shrink a
in
Rose a (Lazy.List.map (shrinkTree shrink) list)
makeInvestigator : Generator a -> Shrinker a -> Investigator a
makeInvestigator gen shrink =
Random.map (shrinkTree shrink) gen
map : (a -> b) -> Investigator a -> Investigator b
map =
Random.map << RoseTree.map
map
,flatMap
, etc... for investigators