[Haskell-beginners] matching the output of a standard function to my function definition (non-exhaustive pattern problem)

Brent Yorgey byorgey at seas.upenn.edu
Mon Sep 27 12:21:08 EDT 2010


On Mon, Sep 27, 2010 at 06:15:22PM +0200, Martin Tomko wrote:
> Dear Daniel
> that worked perfectly, thanks for the suggestion!
> 
> One more question: how do you use null to check for empty lists?
> something like [] == null did not work ... just chekcing, I got my
> orignal code to work, thanks again!
> Martin

When in doubt, consult the types!

  null :: [a] -> Bool

That is, null is a function for testing lists to see whether they are
empty.  So rather than 'list == null' you write 'null list'.

-Brent


More information about the Beginners mailing list