#Why does actor.call work with a type when it's expecting a function?

1 messages · Page 1 of 1 (latest)

leaden drift
cobalt crown
#

Pop isn't a type, it's a value constructor, aka a function

#

Message(Int) is a type and the value Pop(12) belongs to that type

leaden drift
#

Oh, OK, so every value constructor is basically a function. So Pop(Subject(Something)) is like a fn (Subject(Something)) { Pop(Subject(Something)) }, right?

#

Is it possible to somehow curry that function, so if it has more arguments I can still use it this way?

#

Something like Pop(Subject(...), SomeData), so I can still use it the same way as in the example.

stoic token
#

you can use the _ shorthand, like Pop(_, SomeData), or a lambda if it's more complex/nested than that

leaden drift
#

Only one capture is allowed, right?

stoic token
#

yes, but process.call can only take an arity-1 function anyway