On Tue, May 28, 2013 at 1:54 AM, Dominique Devriese
dominique.devri...@cs.kuleuven.be wrote:
Hi all,
I often find myself needing the following definitions:
mapPair :: (a - b) - (c - d) - (a,c) - (b,d)
mapPair f g (x,y) = (f x, g y)
mapFst :: (a - b) - (a,c) - (b,c)
mapFst f =
On Thu, May 30, 2013 at 7:12 PM, Shachaf Ben-Kiki shac...@gmail.com wrote:
One generalization of them is to lenses. For example `lens` has
both, _1, _2, such that mapPair = over both, mapFst = over
_1, etc., but you can also get fst = view _1, set _2 = \y' (x,_)
- (x,y'), and so on. (Since
I was trying to figure out a way to write absurd :: (forall p. p Char
- p Bool) - Void using only rank-n types. Someone suggested that
Haskell with RankNTypes and a magic primitive of type (forall p. p
Char - p Bool) might be sound (disregarding the normal ways to get ⊥,
of course).
Is that true?
On Mon, Jan 28, 2013 at 4:27 PM, Artyom Kazak artyom.ka...@gmail.com wrote:
Hi!
I’ve always thought that `quotRem` is faster than `quot` + `rem`, since both
`quot` and `rem` are just wrappers that compute both the quotient and the
remainder and then just throw one out. However, today I looked
With Don Stewart's blessing
(https://twitter.com/donsbot/status/267060717843279872), I'll be
taking over maintainership of ghc-core, which hasn't been updated
since 2010. I'll release a version with support for GHC 7.6 later
today.
Shachaf
___
On Sat, Sep 3, 2011 at 19:34, Daniel Peebles pumpkin...@gmail.com wrote:
...
Of course, the fact that the return method is explicitly mentioned in my
example suggests that unless we do some real voodoo, Applicative would have
to be a superclass of Monad for this to make sense. But with the new
On Wed, Nov 4, 2009 at 3:14 PM, Jason Dagit da...@codersbase.com wrote:
On Wed, Nov 4, 2009 at 2:21 PM, Torsten Otto t-otto-n...@gmx.de wrote:
Hi!
My students have the task to program an interactive chatbot. We have run
into a problem that I can't solve either:
When we read the user's
LFNW 2009 (http://linuxfestnorthwest.org/) is going to be at the end of
April, and I was wondering if anyone here is going to be there, or possibly a
Haskell-related presentation.
Last year I met ac from #haskell there, but it would be nice if more people
came, especially with the (relatively)
Hi
(=) :: Parser a - Parser b - Parser b
p = f = \inp -
case p inp of
[] - []
[(v, out)] - parse (f v) out
based on a lot of guesswork, after the mess created by the OCR, I
managed to get the above example to work syntactically but is it
semantically correct?
Thanks, Paul
On Nov 20, 2007 7:07 PM, Don Stewart [EMAIL PROTECTED] wrote:
You can work around it for now with:
Prelude Text.Printf printf %02d\n 3 return ()
03
It may be simpler to specify the type explicitly:
Prelude Text.Printf printf %02d\n 3 :: IO ()
03
Shachaf
On Nov 14, 2007 4:27 PM, Justin Bailey [EMAIL PROTECTED] wrote:
It's:
f $! x = x `seq` f x
That is, the argument to the right of $! is forced to evaluate, and
then that value is passed to the function on the left. The function
itself is not strictly evaluated (i.e., f x) I don't believe.
On 10/30/07, Tim Chevalier [EMAIL PROTECTED] wrote:
On 10/30/07, noa [EMAIL PROTECTED] wrote:
Hi!
I have the following function:
theRemainder :: [String] - [String] - Double
theRemainder xs xt = sum( map additional (unique xs) )
where
additional x = poccur * (inf
Hi all,
Given the follwing function:
owner :: Step - Scenario
owner (Step id scenario action state response) = scenario
Is it possible to define the owner function in such way that I can write
x.owner (returning the scenario related with the Step x)?
Some people use (|), which looks
I also commented out arrows as a dependency in the .cabal, I think.
Was that not a good idea? it seemed to work.
Shachaf
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
on, which will appear in Data.Function in the next release of base,
is defined thusly:
on :: (b - b - c) - (a - b) - a - a - c
(*) `on` f = \x y - f x * f y
You can also use Data.Ord.comparing, in this case -- comparing is just
(compare `on`).
From Ord.hs:
-- |
-- comparing p x y =
For the monadically-challenged, this is equivalent, yes-no?
maxsubarrays = maximumBy (compare `on` sum) . concat . (map tails) .
inits
Or: maxsubarrays = maximumBy (compare `on` sum) . concatMap tails . inits
(=) for lists is just (flip concatMap).
Also, this is working with lists, not arrays
16 matches
Mail list logo