Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New workflows #387

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

New workflows #387

wants to merge 1 commit into from

Conversation

alexfmpe
Copy link
Member

@alexfmpe alexfmpe commented Jan 21, 2020

For examples, see https://github.com/alexfmpe/obelisk/tree/ae%40test-new-workflows. which currently has this code inlined for faster prototyping. Now that ob run supports loading dependencies into its repl, I'll switch to that instead.

The advantage of Wizard and Stack over Workflow is that they can be composed easily. A Workflow declares all its future replacements up-front, while Wizard and Stack pieces can be created from a m (Event t a) widget, with a life-cycle then being specified by chaining several widgets monadically. AFAICT this is similar to Concur's Widget

Only one layer of a Wizard exists at any given time. Each time a wizard layer triggers its Event, it is completely replaced by the following one.
Wizard is adapted from https://github.com/reflex-frp/reflex/compare/workflow-monad.

All layers of a Stack are can be present at the same time. Each time one layer triggers its Event, its entire sub-stack is replaced with a single child layer. A Stack can be made incremental with recourse to MaybeT.
Stack (or rather, something that looked similar but was completely bugged) was discovered by accident while trying to get away with type tetris and failing miserably.

The same temporal flow can be re-used for Stack and Wizard:

let
  someFlow mkFlow x0 = do
    x1 <- mkFlow x0
    x2 <- mkFlow x1
    x3 <- mkFlow x2
    pure x3

  myStack = stack . someFlow (step . someButton)
  myWizard = wizard . someFlow (step . someButton)

To-do in no particular order:

  • Remove unsafeCoerce
  • Add documentation
  • Review typeclasses/constraints/laws. I made a beeline for a working Bind/Monad and didn't pay much attention to the rest.
  • Test for leaks
  • Test simultaneous occurrences
  • Investigate relationship between Workflow and Wizard
  • Try to make incremental stacks more ergonomic
  • Try to make wizard/stack agnostic flows more ergonomic
  • Try to make nesting of wizards/stacks/workflows more ergonomic

@Ericson2314
Copy link
Member

@alexfmpe I think we should deprecate Workflow in this library and do this stuff in a new downstream library. (reflex-machines, anyone?)

@alexfmpe alexfmpe force-pushed the ae@new-workflows branch 2 times, most recently from 3d90cd5 to 6ebd299 Compare February 14, 2021 02:06
@alexfmpe alexfmpe changed the title WIP: New workflows New workflows May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants