[Haskell-beginners] Re: Collapsing multiple case branches?

Christian Maeder Christian.Maeder at dfki.de
Sat Jan 3 15:09:23 EST 2009


Colin Paul Adams wrote:
> I have the following function:
> northern_range:: Piece_type -> Int
> northern_range piece 
     | elem piece [Lance, Reverse_chariot, Vertical_mover, etc.] = 11
     | elem piece [Bishop, Kylin, etc.] = 0
     | otherwise = 1

if you have an Eq instance for Piece_type.

Cheers Christian


More information about the Beginners mailing list