roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.4k stars 309 forks source link

Some questions about monomorphizing #1169

Closed jaredly closed 3 years ago

jaredly commented 3 years ago

I don't know if this is the best place to ask about this 😅 but I figured I'd give it a shot. I'm considering doing monomorphization for my language.

  1. How will you handle polymorphic effects?

you mentioned that platforms will provide functions for "performing the actions" associated with an effect; but what if the effects is polymorphic? Will they provide multiple handlers, one for each potential type?

  1. How do polymorphic first-class functions work?
Foo : Foo Int Str
usesAFnInTwoDifferentWays : (x -> x) -> Foo
usesAFnInTwoDifferentWays = \identity -> Foo (identity 2) (identity "hi")

Is identity passed around as a record with a function pointer per realized type? or is it expanded into multiple arguments?

rtfeldman commented 3 years ago

Taking this one to Zulip! 😄