On 19.12.2011 19:29, Henning Thielemann wrote:
Shortest and most obfuscating solution I found is:
import Data.Ord (comparing)
import Control.Applicative (($))
compareLength :: [a] - [a] - Ordering
compareLength = comparing (()$)
comparingLength = comparing void
It's two character shorter
On 01.12.2011 23:47, dokondr wrote:
To be precise, $0 always contains the path to the program called. You
are right, this path will change depending on location from which the
program was called. So $0 is OK for my case, while current directory is
unrelated.
Actually it contains whatever was
On 07.09.2011 00:56, Brandon Allbery wrote:
2011/9/6 Poprádi Árpád popradi_ar...@freemail.hu
mailto:popradi_ar...@freemail.hu
updateData1 :: X - MonadicEnv()
updateData1 d = do; env - get; put env {data1 = d}
updateData1 d = modify (\r - r {data1 = d})
But there is, sadly, no
On 02.08.2011 08:16, Sebastian Fischer wrote:
Data.Foldable also provides the monoidal fold function foldMap. It is
left unspecified whether the elements are accumulated leftwards,
rightwards or in some other way, which is possible because the combining
function is required to be associative.
Any examples for hangups of 'smartEq' are greatly appreciated, I couldn't
produce any so far.
Following sequences will hang smartEq. They are both infinite and aperiodic.
smartEq (fromList primes) (fromList primes)
smartEq (fromList pidigits) (fromList pidigits)
On Fri, Jul 1, 2011 at 12:21 PM, Eugene Kirpichov ekirpic...@gmail.com wrote:
I meant the average of the whole list - given a sumS and lengthS (S
for Stream), write meanS as something like liftS2 (/) sumS lengthS.
Or is that possible with lazy lists too?
Sure you can. Sum, length and mean
On Fri, Jul 1, 2011 at 12:54 PM, Eugene Kirpichov ekirpic...@gmail.com wrote:
Alexey, your definition of mean does not look like liftS2 (/) sum
length - you have to manually fuse these computations.
Well it was fused for numerical stability
I'm asking for a formalism that does this fusion
On 22.06.2011 00:32, pipoca wrote:
On Jun 21, 4:15 pm, Alexander Sollaalex.so...@gmail.com wrote:
The problem is that a sum type must name the different types, or else it
can't give access to them. How is a function supposed to know if a value
blah :: A :+: B
is an A or a B? It seems
On 11.06.2011 02:02, Dmitri O.Kondratiev wrote:
I am looking for platform-independent library to generate simple
histograms in png format.
Does such thing exist?
You may give chart[1,2] a try if dependency on cairo is acceptable.
It can generate PNG among other options.
[1]
forever a = a forever a
doesn't tie to itself without optimisations, so my guess is that it gets
expanded when you run/eval/execState it in ghci, building the thunk
a a a a ...
If you define
forever' a = let a' = a a' in a'
the variant using forever' runs in constant space in ghci.
Hello café!
This mail is literate haskell
I have some difficulties with understanding how bang patterns and seq
works.
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Control.Monad.Trans.State.Strict
leak :: State Int ()
leak = do
a - get
put (a+1)
leak
This function
On 09.06.2011 20:09, Yves Parès wrote:
Is it not:
noLeak :: State Int ()
noLeak = do
a - get
** *let a' = (a + 1)
a' `seq` put a'*
noLeak
??
Indeed. Now I understand. It didn't work for me earlier because of
different behavior of 'forever' in ghci and compiled code.
This
On 30.05.2011 12:26, Bas van Dijk wrote:
On 30 May 2011 00:14, Alexey Khudyakovalexey.sklad...@gmail.com wrote:
It always puzzled me why there are no packages for for testing general
type classes laws. (Monoid laws, monad laws etc). It looks like ideal
case for quickcheck and smallcheck.
How
On 30.05.2011 14:45, Henning Thielemann wrote:
Alexey Khudyakov schrieb:
On 30.05.2011 12:26, Bas van Dijk wrote:
How about 'checkers' by Conal Elliott:
http://hackage.haskell.org/package/checkers
We really need better search on hackage than C-f in browser. I didn't
find them. Thank you
Hello
It always puzzled me why there are no packages for for testing general
type classes laws. (Monoid laws, monad laws etc). It looks like ideal
case for quickcheck and smallcheck.
I'm glad to present package quickcheck-properties[1]. It containt set
of generic properties for semiroups,
On 16.05.2011 22:51, Casey McCann wrote:
How so? Equality on floating point values other than NaN works just
fine and behaves as expected. It's just that they violate all sorts of
algebraic laws when arithmetic is involved so sequences of operations
that should be equivalent aren't, in ways that
Hello everyone!
Haskell have nice automatically derivable Show type class. It's quite
useful for debugging with one exception. String representation of even
moderately large value is completely unreadable (example below).
My question is there any tool for reformatting result of show so it
On 03.05.2011 00:43, Antoine Latter wrote:
On Mon, May 2, 2011 at 3:01 PM, Alexey Khudyakov
alexey.sklad...@gmail.com wrote:
Hello everyone!
Haskell have nice automatically derivable Show type class. It's quite useful
for debugging with one exception. String representation of even moderately
Speaking of that Double instance... both data-binary and cereal use
decodeFloat and encodeFloat which mean they suffer from the same
problems as realToFrac, namely that -0 becomes 0 and NaN becomes
-Infinity (I'm not sure why the latter happens since the decoded
values differ... must be a
On 09.02.2011 20:57, Chris Smith wrote:
On Wed, 2011-02-09 at 18:15 +0100, Cristiano Paris wrote:
I've a type problem that I cannot solve and, before I keep banging my
head against an unbreakable wall, I'd like to discuss it with the
list.
If I'm understanding your high-level goals correctly,
On 09.02.2011 20:15, Cristiano Paris wrote:
Now the problem.
I would like to enforce permissions not at the role level, but at the
permissions level. Let's say that I want to leave unseal unchanged,
I'd like to construct a p-value for unseal combining functions
checking for single permissions,
On 09.02.2011 23:16, Cristiano Paris wrote:
On Wed, Feb 9, 2011 at 19:33, Alexey Khudyakov
alexey.sklad...@gmail.com wrote:
...
If Private is not exported one cannot add instances to PRead.
Nice trick. I would have thought of hiding the classes PRead and
PWrite but I'm not sure if it could
On 06.02.2011 23:29, Johan Tibell wrote:
On Sun, Feb 6, 2011 at 8:48 PM, Andrew Coppin
andrewcop...@btinternet.com wrote:
In particular, I get strange looks from people in the OOP community when I
say I'm using a language that doesn't have any abstractions at all for
dealing polymorphically
On 07.02.2011 00:37, Johan Tibell wrote:
Also there is a container-classes package which provide set of type class
for containers.
I'd like to avoid MPTC and fundeps if possible.
I think haskell2010's type system is just not expressive enough to
create interface generic enough. It's not
On 05.11.2010 14:08, Mitar wrote:
So I know I can move some hard-coded combination into a function. But
I would like to cover all combinations and tell with arguments which
combination I want.
I'm not sure what do you exactly want. But what about applicative
functors? They offer nice notation
We already know that there are noncommutative modules/vectorspaces of
interest (e.g., modules over quaternions and modules over graph paths),
why not support them from the beginning? It seems like you're going out
of your way to exclude things that would be trivial to include. This is
exactly
On Sat, Oct 30, 2010 at 2:07 PM, Henning Thielemann
schlepp...@henning-thielemann.de wrote:
wren ng thornton schrieb:
On 10/22/10 8:46 AM, Alexey Khudyakov wrote:
Hello everyone!
It's well known that Num Co type classes are not adequate for vectors
(I don't mean arrays). I have an idea how
On Wed, Oct 27, 2010 at 2:53 AM, wren ng thornton w...@freegeek.org wrote:
On 10/26/10 8:51 AM, Alexey Khudyakov wrote:
On 24.10.2010 03:38, wren ng thornton wrote:
I don't care much about the name of the class, I'd just like support for
monoids, semirings,... when they lack a group, ring
On 24.10.2010 03:38, wren ng thornton wrote:
On 10/23/10 4:53 PM, Alexey Khudyakov wrote:
On 23.10.2010 05:11, wren ng thornton wrote:
I'd rather see,
class Additive v where -- or AdditiveMonoid, if preferred
zeroV :: v
(^+^) :: v - v - v
class Additive v = AdditiveGroup v where
negateV :: v
On 23.10.2010 05:11, wren ng thornton wrote:
On 10/22/10 8:46 AM, Alexey Khudyakov wrote:
Hello everyone!
It's well known that Num Co type classes are not adequate for vectors
(I don't mean arrays). I have an idea how to address this problem.
Conal Elliott wrote very nice set of type classes
On 24.10.2010 01:19, Daniel Peebles wrote:
Just out of curiosity, why do you (and many others I've seen with
similar proposals) talk about additive monoids? are they somehow
fundamentally different from multiplicative monoids? Or is it just a
matter of notation? When I was playing with building
Hello everyone!
It's well known that Num Co type classes are not adequate for vectors
(I don't mean arrays). I have an idea how to address this problem.
Conal Elliott wrote very nice set of type classes for vectors.
(Definition below). I used them for some time and quite pleased. Code is
On 07.09.2010 20:51, Henning Thielemann wrote:
This solution looks very ugly to me. Catching 'error's is debugging, but
parser failure is kind of exception handling. I guess, the errors you
want to catch are caused by non-supported fail method, right? Can't you
use a monad transformer like
On 05.09.2010 22:02, Don Stewart wrote:
For strict, checked binary parsing, use the cereal package. For lazy
binary parsing with async errors, use binary.
Unfortunately cereal is too slow. I got ~5x slowdown with cereal and had
to patch binary in order to incorporated error handling
On 22.08.2010 21:23, Yves Parès wrote:
In fact the encoding problem is more general.
When I simply do 'readFile bar/fooé', then I'm told:
*** Exception: bar/fooé: openFile: does not exist (No such file or
directory)
How am I supposed to read files whose names contains non-ASCII characters?
(I
On 21.08.2010 01:38, Lars Petersen wrote:
* Float and Double are serialised big-endian according to binary-ieee754
I'd like to point out that binary-ieee754 is dead slow[1] and not usable
when one cares about performance. IMHO lack of ways to serialize
floating point data in IEEE754 format
On 05.08.2010 13:35, Henning Thielemann wrote:
On Wed, 4 Aug 2010, John Meacham wrote:
The numeric classes are sort of messed up when it comes to non integral
values. (not that they are perfect for other things) for instance,
realToFrac doesn't preserve NaN or Infinity,
Why should
On 03.08.2010 21:25, Andrew Coppin wrote:
Now suppose that instead of a container type with an associated element
type, what we want is several pairs of types having a one-to-one
relationship, and we want to be able to traverse that relationship in
either direction. What's the best way to do
On Fri, 30 Jul 2010 15:20:55 -0700
John Meacham j...@repetae.net wrote:
type family Add n m :: *
type instance Add Zero Zero = Zero
type instance Add Zero (SuccessorTo n) = SuccessorTo n
type instance Add (SuccessorTo n) m= SuccessorTo (Add n m)
Standard package
to represent big numbers. Little real
work has been done on this so it's reasonable to expect progress or
even some breakthough.
Maybe some generic inteface for conversion of different representation
of natural numbers would be good. Any suggestions
--
Alexey Khudyakov alexey.sklad...@gmail.com
this function be written without resorting to concrete
monad
--
Alexey Khudyakov alexey.sklad...@gmail.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hello
I'm wondering is there any haskellers in CERN? Given quality
and usability of software there must be people looking for
better alternatives.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Fri, Jul 23, 2010 at 4:04 PM, Daniel Díaz lazy.dd...@gmail.com wrote:
Hi,
I uploaded a package, named HaTeX, to Hackage, but it gets a build failure:
Any idea?
Cabal file has BOM in the beginning. Maybe it make parser choke...
___
Haskell-Cafe
On Sat, Jul 3, 2010 at 8:57 PM, braver delivera...@gmail.com wrote:
I dump results of a computation as a Data.Trie of [(Int,Float)]. It
contains about 5 million entries, with the lists of 35 or less pairs
each. It takes 8 minutes to load with Data.Binary and lookup a single
key. What can
On Sat, Jul 3, 2010 at 10:54 PM, Alexey Khudyakov
alexey.sklad...@gmail.com wrote:
On Sat, Jul 3, 2010 at 8:57 PM, braver delivera...@gmail.com wrote:
I dump results of a computation as a Data.Trie of [(Int,Float)]. It
contains about 5 million entries, with the lists of 35 or less pairs
each
On Mon, Jun 28, 2010 at 7:02 PM, Jake McArthur jake.mcart...@gmail.com wrote:
On Sun, Jun 27, 2010 at 4:44 PM, Alexey Khudyakov
alexey.sklad...@gmail.com wrote:
Dependent types would be nice but there isn't anything usable out there.
Newtype wrapper parametrized by type level number works fine
On Fri, 25 Jun 2010 18:30:06 -0300
Felipe Lessa felipe.le...@gmail.com wrote:
On Fri, Jun 25, 2010 at 12:41:48AM +0400, Alexey Khudyakov wrote:
Then constructor like one below arise naturally. And I don't know how to
write
them properly. It's possible to use fromList but then list could
encoding.
--
Alexey Khudyakov alexey.sklad...@gmail.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Sun, 27 Jun 2010 19:55:21 +1000
Roman Leshchinskiy r...@cse.unsw.edu.au wrote:
On 25/06/2010, at 06:41, Alexey Khudyakov wrote:
Then constructor like one below arise naturally. And I don't know how to
write
them properly. It's possible to use fromList but then list could
On Mon, Jun 28, 2010 at 12:00 AM, Alexander Solla a...@2piix.com wrote:
On Jun 27, 2010, at 12:29 PM, Alexey Khudyakov wrote:
This is of course faster but what I really want is vectors with length
parametrized by type. This way I can write generic code. Uniform
representation is requirement
On Sat, 26 Jun 2010 10:14:50 -0300
Felipe Lessa felipe.le...@gmail.com wrote:
On Sat, Jun 26, 2010 at 05:01:06PM +0400, Bulat Ziganshin wrote:
but what you propose cannot be used in Windows at all! while current
FilePath still works on Unix, with manual filenames en/decoding
Now we got
Hello, cafe
I have question about vector package.
Currently I'm playing with data types which are isomorphic to vectors of fixed
length. Think about vector in N-dimensional space, list of parameters to
function R^n → R, set of measurements with uncertainties, etc. They have
different semantics
On Thu, 17 Jun 2010 13:45:16 -0400
cas...@istar.ca wrote:
:)
Objection!
http://hackage.haskell.org/package/BASIC
A simplified version of the original BASIC embedded in Haskell.
--
Alexey Khudyakov alexey.sklad...@gmail.com
___
Haskell-Cafe
On Fri, Jun 4, 2010 at 8:02 PM, Pete Chown 1...@234.cx wrote:
I've been trying to get in touch with the maintainers of the Binary package,
to report an issue. When I emailed the addresses given on Hackage, I got an
automated response saying I had used an address that was no longer current.
I
On Fri, Jun 4, 2010 at 8:31 PM, Alexey Khudyakov
alexey.sklad...@gmail.com wrote:
Here is code I use to work around this issue:
Forgot to mention. This code checks for end of input. Your data is
infinite so you simplify
definition if you like
2009/12/4 Roman Salmin roman.sal...@gmail.com:
On Fri, Dec 04, 2009 at 01:43:42PM +, Matthias Görgens wrote:
_So my strong opinion that solution is only DSL not EDSL_
Why do you think they will learn your DSL, if they don't learn any
other language?
I didn't said that they didn't
On Fri, Nov 27, 2009 at 10:36 PM, Mark Lentczner ma...@glyphic.com wrote:
I'm in the same quandary:
Data.Binary from the binary package has no error handling
Data.Serialize from the cereal package uses only strict ByteString
I was going to add error handling to Binary as a weekend project
Hello
Is there any plans to add error handling for binary? When it comes to
binary parsing most awkward part is error handling
I presume answer will be like there are some vague plans but no one
to implement them so the second question how could it be done?
Naive implementation of error
On Sun, Nov 15, 2009 at 8:59 PM, Don Stewart d...@galois.com wrote:
alexey.skladnoy:
I found that perfomace of indexU is very poor and it is not fast O(1)
operation which is very surprising. Here is some benchmarcking I've
done. Everything compiled with -O2
You're using the streamed version
Hello
This post meant to be literate haskell.
I found that perfomace of indexU is very poor and it is not fast O(1)
operation which is very surprising. Here is some benchmarcking I've
done. Everything compiled with -O2
Code below converts square 2D array to list of 1D arrays. Summation of
array
On Sun, Nov 15, 2009 at 5:50 PM, Felipe Lessa felipe.le...@gmail.com wrote:
On Sun, Nov 15, 2009 at 03:00:34PM +0300, Alexey Khudyakov wrote:
Naive implementation using lists and index lookup.
2.15 second for 200*200 array
sliceXlist :: Int - UArr Double - [UArr Double]
sliceXlist n
Yes. We decided that having the Get monad as a lazy state monad just
doesn't make sense. It makes this one use case work, but causes more
problems generally. Certainly we need to be able to do lazy binary
deserialisation too, but our feeling is that it should be more explicit
and integrate
On Wed, Sep 23, 2009 at 11:19 PM, Daniel Peebles pumpkin...@gmail.com wrote:
I believe this is a bug that was introduced in 6.10.2 (it definitely
worked in 6.10.1) that has since been fixed in HEAD. This newtype
deriving issue also prevents the uvector testsuite from running at the
moment.
On Mon, Jun 29, 2009 at 12:58 PM, Ketil Maldeke...@malde.org wrote:
Hi,
A bit off-topic, but this is the café, after all...
Like many here, I run XMonad as my window manager on top of Linux.
On - at least my brand of - Linux, networking is generally handled by
NetworkManager, which really
I have so far only tested it with ghc 6.8.3 on MacOS 10.3.9 (powerPC),
but I know of no reason why it wouldn't work with other versions and
OSs.
It breaks on Linux (and all unices) because name of file in tarball is
'rungekutta.hs' not
'RungeKutta.hs' as required. In other words: god blame
This upsets me. We need to get on with doing this properly. The
System.IO.UTF8 module is a useful interim workaround but we're not using
it properly most of the time.
... skipped ...
The right thing to do is to make Prelude.putStrLn do the right thing. We
had a long discussion on how to
(possibly millions of elements) and it will traverse
input data for each histogram.
It seems that I need to use mutable array and/or ST monad or something else.
Sadly both of them are tricky and difficult to understand. So good examples or
any other ideas greatly appreciated.
--
Alexey Khudyakov
67 matches
Mail list logo