Easily typable API call signatures for a clean design & typed language wrappers

This was brought up on Famous’ Slack #engine. Having gotten an initially promising response from @trusktr, I’m bringing the topic up here as he indicated.

Here are the excerpts from our short discussion there:

my main motivation is for the core parts of the engine (as opposed to the higher level abstractions for “less advanced” devs) to be easily typed using languages such as PureScript, and Haskell via GHCJS. it’s doubtable if this aligns with the objectives of the Infamous team

I then also brought up FRP’ness of Infamous, but I think that aspect can and should be addressed separately and is much less important than that of simple and easily typable call signatures.

@trusktr: /…/ I’m just hoping the low level API won’t be as heavily dynamic as that of Famous, where function signatures are heavily overloaded, in a way that is very difficult to map to a type system without using some sort of dynamic/static analysis tools. with Famous, it is/was a tedious step-by-step trial-and-error process.

imo Famous’s API functions contain quite a few if-else-switch-whatnot checks to decide which actual “variant” of a function was called based on the passed in arguments, their types and even the names of the ​call-site variables.

I can’t remember from the back of my head which specific parts of the Famous Engine/Framework API were cumbersome to analyse from a typing point of view, but I believe it’s worth bringing this up. I believe it can benefit both Infamous itself, as well as anybody who were to write a PureScript, Haskell/GHCJS, TypeScript, Scala.js or whatever other statically typed language wrapper for Infamous.