Skip to content

Instantly share code, notes, and snippets.

@techtangents
Created December 8, 2012 03:08
Show Gist options
  • Save techtangents/4238402 to your computer and use it in GitHub Desktop.
Save techtangents/4238402 to your computer and use it in GitHub Desktop.
type Stepper v = StepperImpl v s
data StepperImpl v s = StepperImpl {
initial :: s,
next :: s -> (v -> s -> StepState v s) -> StepState v s -> StepState v s
}
data StepState v s = More v s | Done
step1 :: StepperImpl v s -> StepState v s
step1 k@(StepperImpl init _) = step k init
step :: StepperImpl v s -> s -> StepState v s
step (StepperImpl _ n) = f s More Done
data StepperRun v s = StepperRun (StepperImpl v s) (StepState v s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment