moduleExtrawhereimportIximportData.Set(Set,toList)

Here is a convenient way to obtain a list of all values of a given type, e.g. all states in a model.

enumAll::(Boundeda,Ixa)=>[a]enumAll=range(minBound,maxBound)

The `ShowBits` class provides a way to print bit vectors, represented
as tuples of booleans, in a compact and readable way, e.g. `010` instead of
`(False,(True,False))`

classShowBitsswhereshowBits::s->ShowS

Single booleans are shown as 0 and 1 instead of False and True.

instanceShowBitsBoolwhereshowBits=shows.fromEnum

Pairs of bit vectors are just concatenated.

instance(ShowBitsa,ShowBitsb)=>ShowBits(a,b)whereshowBits(a,b)=showBitsa.showBitsb

When showing a list or a set of bit vectors, the elements are separated by spaces.

instanceShowBitsa=>ShowBits[a]whereshowBits=foldr(\xr->showBitsx.(' ':).r)idinstanceShowBitsa=>ShowBits(Seta)whereshowBits=showBits.toList

Use `B v` if you want to display a bit vector `v` in the compact
readable way.

newtypeBa=BainstanceShowBitsa=>Show(Ba)whereshowsPrec_(Ba)=showBitsa

A type for transitions and a nice way to show them

dataTranss1s2=s1:->s2instance(ShowBitss1,ShowBitss2)=>Show(Transs1s2)whereshowsPrec_(s1:->s2)=showBitss1.(" -> "++).showBitss2showList=showsLinesshowsLinesxsr=foldrshowsLinerxswhereshowsLinexr=showsx('\n':r)