[Haskell-cafe] Yet more type confusion

Cale Gibbard cgibbard at gmail.com
Mon Nov 20 05:51:02 EST 2006


Never use (/= "") or (/= []), use (not . null), which doesn't have the
Eq constraint.

On 20/11/06, Daniel McAllansmith <dm.maillists at gmail.com> wrote:
> On Monday 20 November 2006 20:44, chris moline wrote:
> > Hey all, I'm thoroughly confused by the type error
> > produced by the following:
> > > sep :: (a -> Bool) -> [a] -> [[a]]
> > > sep p = takeWhile (/= "") . iterT (breakDrop p)
>
> It'll be the "" in (/= "").
>
> Maybe you want to be using (/= []) ?
> That will work for any type a in the Eq class.
>
> Daniel
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list