Re: [Haskell-cafe] Substituting values

2012-12-25 Thread Radical
Hey Petr, On Sat, Dec 22, 2012 at 9:52 AM, Petr P petr@gmail.com wrote: I think you need something wha Scala has - the ability to create a partial function from a case expression. In Scala you could write def update[A](f: PartialFunction[A,A])(v: A): A = f.orElse({ case x = x } :

Re: [Haskell-cafe] Substituting values

2012-12-24 Thread Radical
On Sat, Dec 22, 2012 at 12:35 AM, Kim-Ee Yeoh k...@atamo.com wrote: This is reminiscent of the Either (exception) monad where Left values, the exceptions, pass through unaltered, and Right values are transformable, i.e. acted on by functions. Interesting. I hadn't thought of that parallel.

Re: [Haskell-cafe] Substituting values

2012-12-24 Thread Radical
verbosity at the call site) replaceIf p r a = if p a then r else a replaceIf (== Foo) Bar value On Fri, Dec 21, 2012 at 6:46 PM, Radical radi...@google.com wrote: Sometimes I'll need something like: if value == Foo then Bar else value Or some syntactic variation thereof: case

[Haskell-cafe] Substituting values

2012-12-21 Thread Radical
Sometimes I'll need something like: if value == Foo then Bar else value Or some syntactic variation thereof: case value of { Foo - Bar; _ - value } Is there a better/shorter way to do it? I'm surprised that it's more complicated to substitute a value on its own than e.g. in a list, using

Re: [Haskell-cafe] Hoogle index completeness

2012-12-20 Thread Radical
Thanks for the suggestion, Jan. Is there a way to include all of hackage? Alvaro On Thu, Dec 20, 2012 at 3:37 AM, Jan Stolarek jan.stola...@p.lodz.plwrote: I see that the comments are from years ago. Are there any ongoing efforts to expand the default search set? (Or alternatively, to

[Haskell-cafe] Hoogle index completeness

2012-12-19 Thread Radical
Searching Hoogle for symbols like `rstrip` or `lstrip` produces No results found for me, even though they exist in the MissingH library. To wit: http://hackage.haskell.org/packages/archive/MissingH/1.2.0.0/doc/html/Data-String-Utils.html Is this behavior intentional, or a regression of some

Re: [Haskell-cafe] Hoogle index completeness

2012-12-19 Thread Radical
solution is to install Hoogle locally and let it index all packages you have installed. Best regards, Petr 2012/12/19 Radical radi...@google.com Searching Hoogle for symbols like `rstrip` or `lstrip` produces No results found for me, even though they exist in the MissingH library. To wit: http