[Haskell-cafe] a simple function

wenduan xuwenduan2010 at gmail.com
Mon Jul 11 22:45:45 EDT 2005

Anyone please tell me what is wrong with the function:

isEmpty ::[a]->Bool
isEmpty xs | xs == []   = True
                  |otherwise   =False
When I tried to load it into the interpreter,it says the following:

    Could not deduce (Eq a) from the context ()
      arising from use of `==' at mylab2.hs:16
    Probable fix:
        Add (Eq a) to the type signature(s) for `isEmpty'
    In a pattern guard for
       the definition of `isEmpty':
        xs == []
    In the definition of `isEmpty': isEmpty xs | xs == [] = True


More information about the Haskell-Cafe mailing list