[Haskell-beginners] Finite State Machine ..

Tom Poliquin poliquin at softcomp.com
Sat Feb 28 21:36:22 EST 2009

I'm working on a project (in Haskell) and was
given some old Java code to indicate the required
functionality for a particular function. It's a page of 
nested (4 deep) if statements. (That's probably
why they gave me the code, no one could 
describe it).

I would normally convert this to an FSM,
..... but this is Haskell!


1) Is there a nice (canonical) way of eliminating
  nested evil in Haskell?  I thought that perhaps making
  a tuple of all the if's conditions and patterm matching
  on them might make a bit more comprehensible.
  Likely there's a better way.

2) If an FSM is appropriate is there a 'standard' 
  Haskell  FSM implementation?
  I looked around and could find very little. One
  paper talked about Arrows but that seems like a bit
  of overkill ..

It actually seems like a fun problem  .. if I
had the time ..

Any thoughts greatly appreciated!


More information about the Beginners mailing list