Misc. Haskell stuff

Chain compare

Define chained operators, for ease of entering expressions like 1 < 2 < 3. This module defines three extra variations of each of the operators <, <=, and ==, for use at the beginning, middle, and end of such chains. These operators have dots on the inside of the chain, for instance:

x <. y .< z
1 <. 2 .<. 3 .<=. 3 .< 4
square (0,0) ==. square (0,1) .== square (0,2)

These operators are defined to be left-associative and the same precedence as the ordinary comparison operators.

Download ChainCompare.hs (view)