Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Since the type is inferred, why can't the module name by convention be inferred from the data type in pipe operations?

So instead of:

["a", "b", "c"] |> List.append "d" |> List.append "e" |> List.append "f"

You could have:

["a", "b", "c"] |> append "d" |> append "e" |> append "f"

Since Roc knows that the type returned from each function is a List.



Roc cares a lot about explicitness, so I don't think this would be a wanted feature. That said, it is easy to get this functionality with something like ``` append = List.append ```

An important note is that any module could expose an append function that has the same interfaces as `List.append`, so that could easily lead to confusion.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: