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
WebSharper 4 fails to compile the following valid F# code, with "Failed to resolve generic parameter: b, found: a":
let span pred l =
let rec loop l cont =
match l with
| [] -> ([],[])
| x::[] when pred x -> (cont l, [])
| x::xs when not (pred x) -> (cont [], l)
| x::xs when pred x -> loop xs (fun rest -> cont (x::rest))
| _ -> failwith "Unrecognized pattern"
loop l id
The text was updated successfully, but these errors were encountered:
Thanks for the report. In your sample, you can remove inner generics by a type annotation (cont: 'a list -> 'a list)
Generally, compiler could be improved that inner generic type parameters do not give an error, only when a macro would need it (when translation depends on the type), and then give a better error to move the function to a top level [<Inline>] for proper generic use.
Jand42
changed the title
F# compilation: Incorrect type inferrence
F# inner generics
Feb 1, 2017
WebSharper 4 fails to compile the following valid F# code, with
"Failed to resolve generic parameter: b, found: a":
The text was updated successfully, but these errors were encountered: