Visitar URL original
Derive for inductive types with non-type parameters · Issue #286 · QuickChick/QuickChick · GitHub
Skip to content

Derive for inductive types with non-type parameters #286

Open

Description

@annenkov

I've stumbled upon the following issue. Derive fails when I try to use it on something like this:

Record D := { Address : Type}.

Inductive msg {d : D} :=
  | send : Address d -> msg.

So, Derive Arbitrary for msg. gives

Error:
In environment
d : Type
mu6_ : Gen d
The term "d" has type "Type" while it is expected to have type "D".

Activity

  1. annenkov commented on May 12, 2022

    @annenkov
    Author

    I think something like this could be generated (just by changing the case when d is a type):

      fun (d : D) (mu9_ : Show (Address d)) =>
        {|
          show := fun x : msg =>
                    let
                      fix aux (x' : msg) : string :=
                      match x' with
                      | send p0 => "send " ++ smart_paren (show p0)
                      end in
                    aux x |}.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions