You can make a basic type system that wraps your language like c#, and add support for union types. The nodes and the nodes values(slots) will each have a type which could be a union. Then you can define operators(also typed nodes) that work on typed params.
Add -> FoF<ret, args>. Then evaluate