Dear Michael,
I’m wondering if I missed something, but is there a mailing list for
stackage? Or has one of the standard lists (-cafe, libraries) been
designated for questions about stackage?
What I want to know is if you plan to provide a website for stackage
soon where the list of included
Seems like the function is easy to define:
replaceIfEq a b c = if c == a then b else c
Then the above can be written
replaceIfEq Foo Bar value
Or the slightly more general (in exchange for slightly more verbosity at
the call site)
replaceIf p r a = if p a then r else a
replaceIf (==
Hi Alvaro,
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 } : PartialFunction[A,A]).apply(v);
and then use it like
update[Int]({
2012/12/21 Radical radi...@google.com:
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
Sorry for the double-post, sent the first one from the wrong email address.
Hi Joachim,
I have not yet created a mailing list, but it should certainly be done.
There is also not yet a web site for Stackage, but there should be one in
the near future. At the very least, we'll need to host
I've looked into the custom Prelude.hs approach, and it's a bit tricky,
but does work out:
https://gist.github.com/4361578
The interpreter needs to run in the same directory as your Prelude.hs.
However, if you try to run ghci in that directory, it will fail -
because it doesn't know that it