You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letrec traversegen=function|[] -> pure []|x :: xs ->
let* x = gen x and* xs = traverse gen xs in
pure (x :: xs)
Or in short:
lettraversegenxs=letcons_fxxs=List.cons <$> gen x <*> xs inList.fold_right cons_f xs (pure [])
I had been in need for this particular combinator in a relatively specific case: when generating well-typed terms of a language with n-ary functions. The term generator takes a type from the object language, and when I wanted to generate a function call, I needed to generate a list of terms from a list of types from the object language.
But maybe there are other use-cases?
The text was updated successfully, but these errors were encountered:
Signature is:
Implementation proposition:
Or in short:
I had been in need for this particular combinator in a relatively specific case: when generating well-typed terms of a language with n-ary functions. The term generator takes a type from the object language, and when I wanted to generate a function call, I needed to generate a list of terms from a list of types from the object language.
But maybe there are other use-cases?
The text was updated successfully, but these errors were encountered: