type inference - Unifying len and S len would lead to infinite value -
i trying make function hpure generates hvect repeating same element until reaches required length. each element may have different type. ex: if argument show each element specialization of show function.
hpure show : hvect [int -> string, string -> string, somerandomshowabletype -> string] this attempt:
hpure : {outs : vect k type} -> ({a : _} -> {auto p : elem outs} -> a) -> hvect outs hpure {outs = []} _ = [] hpure {outs = _ :: _ } v = v :: hpure v this error occurs on final v:
when checking application of main.hpure: unifying len , s len lead infinite value why error occur , how can fix it?
the issue type of v depends on outs, , recursive call hpure passes tail of outs. v needs adjusted well.
the error saying lengths of outs , tail have same in order version typecheck.
here version typechecks.
hpure : {outs : vect k type} -> ({a : type} -> {auto p : elem outs} -> a) -> hvect outs hpure {outs = []} _ = [] hpure {outs = _ :: _} v = v here :: hpure (\p => v (there p))
Comments
Post a Comment