Skip to content

Instantly share code, notes, and snippets.

@maksar
Created August 7, 2016 17:47
Show Gist options
  • Save maksar/d9f8c6203baba64c02444e53858caf89 to your computer and use it in GitHub Desktop.
Save maksar/d9f8c6203baba64c02444e53858caf89 to your computer and use it in GitHub Desktop.
permissionProducer : Producer Permission
permissionProducer =
let permission i = case i of
1 -> VOTE
2 -> FORCE
_ -> NONE
in Check.Producer.map permission <| rangeInt 0 2
userProducer : Producer User
userProducer =
Check.Producer.map (uncurry3 Actor.create) (Check.Producer.tuple3 ( string, bool, list permissionProducer ))
workflowProducer : Producer (Workflow String)
workflowProducer =
Check.Producer.map (\users -> List.foldl Workflow.approve (Workflow.init [1]) users) (list userProducer)
myClaims : Claim
myClaims =
Check.suite "Workflow"
[
claim
"Workflow should remain in its bounds"
`true` (\w -> w.currentStep <= 1)
`for` workflowProducer
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment