computation-hs / comp-models

An implementation of several models of computation.
http://computation-hs.github.io/comp-models/
GNU General Public License v2.0
2 stars 0 forks source link

Automata-related function code style #5

Closed mx-psi closed 9 years ago

mx-psi commented 9 years ago

Automata types are written in record syntax style, providing functions for accessing its elements. Functions are currently written in two different styles:

 process dfa = foldl (transition dfa) (initial dfa)
executeNFA (NFA i _ t) = execWriterT . foldM (logNFA t) i

We should have a common code style for writing these types of functions. I think it would be better to use pattern recognition and rewrite types without using record syntax: it does not provide additional legibility since types are different and it overlaps among automata.

TL;DR: We should have a common code style for automata-related functions.

mroman42 commented 9 years ago

In this case, pattern recongnition is more legible than the record syntax style. The automata execution functions have been rewritten in this style in 986722b.