-- THIS FILE WAS AUTOMATICALLY GENERATED BY AENEAS
-- [polonius_list]
import Base
open Primitives

namespace polonius_list

/- [polonius_list::List]
   Source: 'src/polonius_list.rs', lines 3:0-3:16 -/
inductive List (T : Type) :=
| Cons : T → List T → List T
| Nil : List T

/- [polonius_list::get_list_at_x]:
   Source: 'src/polonius_list.rs', lines 13:0-13:76 -/
divergent def get_list_at_x
  (ls : List U32) (x : U32) :
  Result ((List U32) × (List U32 → Result (List U32)))
  :=
  match ls with
  | List.Cons hd tl =>
    if hd = x
    then Result.ret (List.Cons hd tl, Result.ret)
    else
      do
      let (l, get_list_at_x_back) ← get_list_at_x tl x
      let back_'a :=
        fun ret =>
          do
          let tl1 ← get_list_at_x_back ret
          Result.ret (List.Cons hd tl1)
      Result.ret (l, back_'a)
  | List.Nil => Result.ret (List.Nil, Result.ret)

end polonius_list
