Skip to content

Instantly share code, notes, and snippets.

@paulvictor
Created February 22, 2017 09:18
Show Gist options
  • Save paulvictor/e8625977cda8e4d8a10cde90e9dbd87e to your computer and use it in GitHub Desktop.
Save paulvictor/e8625977cda8e4d8a10cde90e9dbd87e to your computer and use it in GitHub Desktop.
Monadic composition of screens
flow = do
_ <- splashScreen
l <- languageSet
pure(l ? npciSplashScreen : ChooseLanguageScreen)
npciSplashScreen = do
_ <- wait 0
permission <- checkPermission
pure(permission ? postPermission : showPermission)
postPermission = do
t <- registrationToken
pure(t ? rtSet : rtNotSet)
rtSet = do
pc <- passCode
pure(pc ? loginScreen : registerScreen)
rtNotSet = do
nw <- networkAvailable
isBound <- bindDevice
guard isBound
cs <- call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment