@suppi you're a Haskell wizard. Tell me, is there a way to dynamically patch any "object" or state in a Haskell program at runtime, dynamically? For example:

patch(state, {list: {[index]: {prop: value}}})

@zpartacoos can you elaborate more about what you mean when you say patch? Any specific usecase or a before/after you can share?

Follow

@suppi in this context it refers to change grabbing the current state of the program and then changing the code (say, a function in that program) to accommodate for the specific case (state) at runtime.

For example, say the original program starts out with just three functions + some state that is coming from outside world.

--Function 1--
grab_ object: grabs objects from outside when they become available
--Function 2--
update_state: updates state (assume state is complex nested enum-like structure)
--Function 3--
print_state: prints the state

Now, let's say that the objects being fed are themselves dynamic in nature so may look very different at each time step and can itself be interpreted as code (either partially or fully). Can we write a program in Haskell that depending on the structure of the object (which is not enumerable nor known in advanced) apply a "patch" function/operator being sent with the object which changes the way the update_state function and print_state function work?

I suspect there are cleaner/better/intuitive ways of solving this but I'm interested in this specific behavior of being able to effectively re-write the Haskell code itself at runtime kinda like you can dynamic languages.

@zpartacoos this reminds me of essence-of-live-coding
manuelbaerenz.de/essence-of-li
Is this what you are looking for?

Another option is to use an interpreter like hint or purescript i guess

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.