Define an ordering on lists' rules with the following properties:
- rules with a higher coercion level should come first, i.e. the
rules for [Foo3] are before rules for [Foo1] and they are both lower
than rules for [Foo].
- [] < [_] < _:_
This is desiged to correctly order the rules in the prt function for
lists so that the pattern matching works as expectd.
>>> compareRules (npRule "[]" (ListCat (CoercCat "Foo" 3)) [] Parsable) (npRule "[]" (ListCat (CoercCat "Foo" 1)) [] Parsable)
LT
>>> compareRules (npRule "[]" (ListCat (CoercCat "Foo" 3)) [] Parsable) (npRule "[]" (ListCat (Cat "Foo")) [] Parsable)
LT
>>> compareRules (npRule "[]" (ListCat (Cat "Foo")) [] Parsable) (npRule "(:[])" (ListCat (Cat "Foo")) [] Parsable)
LT
>>> compareRules (npRule "(:[])" (ListCat (Cat "Foo")) [] Parsable) (npRule "(:)" (ListCat (Cat "Foo")) [] Parsable)
LT