Skip to content

Make Env-taking generators standalone functions #250

@MattWindsor91

Description

@MattWindsor91

A common pattern in the codebase these days is:

module Foo (Env : Env_types.S) = struct
  let quickcheck_generator = (* ... *)
  (* ... *)
end

let gen_foo env =
  let module F = Foo (struct let env = env end) in quickcheck_generator

This is unnecessarily inducing a lot of module boilerplate we don't need, because we could rewrite to:

let gen_foo (env : Env.t) = (* ... *)

module Foo (Env : Env_types.S) = struct
  let quickcheck_generator = gen_foo Env.env
  (* ... *)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area:FuzzerSpecifically affecting the program mutatorType:EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions