I think the issue was by ths following , You seem to be asking about how to compute the closure of a function under repeated function application. The key to the problem is to find a way to ensure termination, i.e., a way to determine the maximum number of times the function might be called. In this case, an easy upper bound is List.length l; an element cannot have more transitive-parents than there are generations. Using this insight, we can define a function that takes a list of numbers, and outputs a list of those numbers together with all of their parents, and then we apply this function List.length l times to itself, starting with parents of c:
Require Import Coq.Lists.List. Import ListNotations.
Require Import Coq.Sorting.Mergesort. Import NatSort.
Scheme Equality for nat.
Inductive Gen : Set :=
| BGen : nat -> nat -> Gen.
Definition g1 := BGen 1 2.
Definition g2 := BGen 2 3.
Fixpoint parents (l : list Gen) (c : nat) :=
match l with
|  => 
| (BGen p c') :: l' => if nat_beq c c'
else parents l' c
Fixpoint deduplicate' (ls : list nat) :=
match ls with
|  => 
| x ::  => [x]
| x :: ((y :: ys) as xs)
=> if nat_beq x y
then deduplicate' xs
else x :: deduplicate' xs
Definition deduplicate (ls : list nat) := deduplicate' (sort ls).
Definition parents_step (l : list Gen) (cs : list nat) :=
deduplicate (cs ++ List.flat_map (parents l) cs).
Fixpoint all_parents' (l : list Gen) (cs : list nat) (fuel : nat) :=
match fuel with
| 0 => cs
| S fuel'
=> all_parents' l (parents_step l cs) fuel'
Definition all_parents (l : list Gen) (c : nat) :=
deduplicate (all_parents' l (parents l c) (List.length l)).
Definition gs := (g1::g2::nil).
Compute all_parents gs 3. (* [1; 2] *)
I wish did fix the issue. Well, there is nothing stopping Scala from doing so, but, as a matter of fact, they do not express the same thing at all. And, in fact, you can see that in Java, where you can write X super Y, but you can't say class X super Y. The keyword extends express a relationship between classes, one of inheritance. On the other hand, <: and >: express a relationship between types, one of boundaries. When I say X <: Y, then it is valid for both X and Y to be String, for example, while String extends String would be meaningless. It is also the case that List[String] <: List[AnyRef], though, again, List[String] extends List[AnyRef] is meaningless. And, just to make the point, it is not true that Set[String] <: Set[AnyRef]. In all these examples I just gave we are talking about the same class, but not, necessarily, about the same type.
In Scala is there a nicer a way to express the following inheritance?
wish helps you The idiomatic way to do this with Express is to use middleware for the common bits and reuse that middleware in your routes. For example, this middleware can take care of parsing the project data: