Skip to content

Instantly share code, notes, and snippets.

@ZacharyKamerling
Created November 17, 2013 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZacharyKamerling/7515932 to your computer and use it in GitHub Desktop.
Save ZacharyKamerling/7515932 to your computer and use it in GitHub Desktop.
main = showFSM <~ foldp send ("SENT","-> ","SENT") (fps 1)
showFSM (a,b,c) = plainText <| a ++ b ++ c
send _ (stateA,packet,stateB) =
case packet of
"* " -> ("SENT","-> ",stateB)
"-> " -> (stateA," -> ",stateB)
" -> " -> (stateA," ->",stateB)
" ->" -> (stateA," *","SEND")
" *" -> (stateA," <-","SENT")
" <-" -> (stateA," <- ",stateB)
" <- " -> (stateA,"<- ",stateB)
"<- " -> ("SEND","* ",stateB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment