Analog of Android "Activity" in Halogen

halogen

#1

hyperisco [1:45 PM]
as a way of delineating whole-screen user activities
well the idea is an Activity has a lifecycle and it takes up the whole screen, so it becomes wholly in charge of presentation and handling user input
but Activities will want to start other Activities, and you want to keep a history of Activities for navigation purposes
so roughly an Activity is like a web page on a web site
at the top will be an ActivityManager, a Halogen component, whose job it is to switch between Activities
anyways I’ll try what you suggested and see how that pans out
I am just not sure if I will find the Manager is tied up waiting for a response when it needs to be doing other work

natefaubion [1:51 PM]
Slamdata did this with it’s card mechanism
Let me find an example
in ancient slamdata

hyperisco [1:53 PM]
ancient eh? suggests they moved away from such a thing

natefaubion [1:53 PM]
Ancient in that it isn’t open source anymore, but I forked it a couple years ago
Components in slamdata would conform to an interface via a Coproduct https://github.com/natefaubion/slamdata/blob/master/src/SlamData/Workspace/Card/Download/Component.purs#L87-L114 which took various lifecycle queries
https://github.com/natefaubion/slamdata/blob/master/src/SlamData/Workspace/Card/Component.purs#L161-L221 and they would be wrapped in this, which managed all those events

hyperisco [1:56 PM]
right so I am thinking something like data ActivityQuery a = Finalize (Boolean → a) where true means “keep killing me” and false means “please stop”
presumably the query evaluator in the Activity can do as much as it wants during handling this finalization request

natefaubion [1:56 PM]
Yes

hyperisco [1:58 PM]
that’s something you don’t get in Java-world because you aren’t constructing a monad action
you just have a method which has to synchronously make a determination
(well actually there is no good way to implement this sort of interrupt… Android Activities are dumpster fires)
so in Android when one Activity wants to start another it emits an Intent, which is an object describing what it wants to do
I am guessing the translation here is to use component outputs
since IIUC outputs happen at the discretion of the component rather than having to wait for a query