Re: [Haskell-cafe] Tracer for Haskell showing substitutions

2010-02-02 Thread Ezra Lalonde
Hi, Hat: The Haskell Tracer. http://www.haskell.org/hat/ From the site: Hat helps locating errors in programs. Furthermore, it is useful for understanding how a (correct) program works, especially for teaching and program maintenance. Hat is not a time or space profiler. Hat can be used for

Re: Re[Haskell-cafe] cursive to foldr

2009-11-17 Thread Ezra Lalonde
Using the same basic structure you did, and foldr, I think below is the simplest method: import Data.Maybe searchList :: (a - Bool) - [a] - Maybe [a] searchList p xs = foldr (\x acc - if p x then Just (x: fromMaybe [] acc) else acc) Nothing xs ghci

Re: [Haskell-cafe] Help to solve simple problem !

2009-11-10 Thread Ezra Lalonde
The following program should work: ===compress.hs= toList :: (Eq a) = [a] - [[a]] toList [] = [] toList x = start : toList end where (start, end) = span (==(head x)) x toTuple :: [a] - (a, Int) toTuple x = (head x, length x) compress :: Eq a = [a] - [(a, Int)] compress x =