-
(Preface: I see other users and you mentioning that your library takes inspirations from many languages such as Haskell, Erlang, Clojure and its common approaches to build programs written in a functional way, but as I'm not well-experienced in that area, I'm asking about some tips or approved articles to study.) As far as I know, Microsoft offers a way to build a program with a generic Host feature. However, I was looking for some guidelines on how to do it in a fully functional way, but unfortunately it seems it's a bit complex topic to explain, since wiki is missing an article about structuring the application. So, my questions are:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is some general advice in the Thinking Functionally part of the wiki. But it's maybe a little dated now and could do with a refresh now that the effects system is in language-ext.
Because each actor has its own state and it can only be interacted with via messaging (events) it has the benefit of being an encapsulated world. And because it's single threaded, it becomes very easy to reason about - no complex concurrency issues. The inbox function is effectively a fold over a stream of messages. This has lots of nice functional properties within the process, but still allows for the sticky thing of 'world state' to exist. You certainly don't have to use By the way, in one of the other discussions here, I implement a simple actor system just using the
The other examples in Finally, you might want to look into the Concurrency section of the wiki. It's useful for handling global state for whatever framework you decide to plug in to. In terms of Microsoft and what they've decided is the way to write applications this week, this library steers clear of that. Language-Ext isn't opinionated about architecture really. This closest it gets at the moment is the effects-system ( |
Beta Was this translation helpful? Give feedback.
There is some general advice in the Thinking Functionally part of the wiki. But it's maybe a little dated now and could do with a refresh now that the effects system is in language-ext.
echo-process
is just one way of building an app. The benefits are that each process is an actor. Actors are single-threaded message-processors with state. Each message processed from their inbox of messages optionally updates that state. The messages and state can be persisted (in Redis). Each process can spawn child processes. This creates a supervision hierarchy.Because each actor has its own state and it can only be interacted with via messaging (events) it has the benefit of being an encapsulated world