[Haskell-beginners] Need Help

kaushal Pathak kaushalkp at gmail.com
Wed Apr 29 09:05:24 EDT 2009

Here is another one liner I am stuck at(Find permuation of string), here is
my one line code :

permute myStr = foldr(\x acc -> (zipWith (\x1 y1 -> x1 ++ [x] ++ y1) (inits
acc) (tails acc))) [] myStr

and here is 5 line error ;-(

    Occurs check: cannot construct the infinite type: a = [a]
      Expected type: [a]
      Inferred type: [[a]]
    In the expression:
        (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails acc))
    In the first argument of `foldr', namely
        `(\ x acc
              -> (zipWith (\ x1 y1 -> x1 ++ x ++ y1) (inits acc) (tails

Will really appreciate your help in moving ahead

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090429/39380333/attachment-0001.htm

More information about the Beginners mailing list