You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In https://github.com/turion/essence-of-live-coding/ there is a type that is very similar to AutomatonT, but it differs by having the Data constraint on the internal state. This was an arbitrary decision, and any other serialization type with sufficient introspection would be suitable as well, e.g. Generic, or maybe even IsAcidic (see turion/essence-of-live-coding#124). There might also be other constraints that give useful features.
The idea is to generalise StreamT (and thus all other types) to include one more type level argument c:
Instantiating c at Data would then give the current implementation of essence-of-live-coding, allowing to refactor it and reduce the code base. Instantiating it at IsAcidic gives applications whose state can be persisted using acid-state, and so on.
The downside is that this changes a lot of type signatures. It might be possible to create a type alias and use this:
typeStreamTma=CStream()ma
But it's unclear how ergonomic this is, since still all functions need to be written in the more general style.
For some functions, the type signature is even more restricted. Whenever state is added, we need to make sure the whole state is an instance of the type class. E.g. the type signature of feedback might now be:
feedback::
(Functorm, cs, (foralls'.cs'=>c (ResultStatess'))) =>--| The additional internal states->--| The original automatonAutomatonm (a, s) (b, s) ->Automatonmab
The text was updated successfully, but these errors were encountered:
Another great example would be adding a kind of CRDT constraint on the internal state. Then it is conceivable that we could run two copies of the same program on different machines, constantly synchronising their state.
In https://github.com/turion/essence-of-live-coding/ there is a type that is very similar to
AutomatonT
, but it differs by having theData
constraint on the internal state. This was an arbitrary decision, and any other serialization type with sufficient introspection would be suitable as well, e.g.Generic
, or maybe evenIsAcidic
(see turion/essence-of-live-coding#124). There might also be other constraints that give useful features.The idea is to generalise
StreamT
(and thus all other types) to include one more type level argumentc
:Instantiating
c
atData
would then give the current implementation ofessence-of-live-coding
, allowing to refactor it and reduce the code base. Instantiating it atIsAcidic
gives applications whose state can be persisted usingacid-state
, and so on.The downside is that this changes a lot of type signatures. It might be possible to create a type alias and use this:
But it's unclear how ergonomic this is, since still all functions need to be written in the more general style.
For some functions, the type signature is even more restricted. Whenever state is added, we need to make sure the whole state is an instance of the type class. E.g. the type signature of
feedback
might now be:The text was updated successfully, but these errors were encountered: