Re: [Haskell-cafe] Performance of delete-and-return-last-element

2013-08-30 Thread Clark Gaebel
I don't think a really smart compiler can make that transformation. It looks like an exponential-time algorithm would be required, but I can't prove that. GHC definitely won't... For this specific example, though, I'd probably do: darle :: [a] - (a, [a]) darle xs = case reverse xs of []

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-07-18 Thread Clark Gaebel
No I haven't. - Clark On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen m...@nh2.me wrote: Did you file this as a bug? On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote: I'm on 7.6.2, and it does. Oh no. - Clark On Tuesday, April 23, 2013, Tom Ellis wrote: On Tue, Apr 23

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-07-18 Thread Clark Gaebel
Gaebel wrote: No I haven't. - Clark On Thu, Jul 18, 2013 at 10:07 PM, Niklas Hambüchen m...@nh2.me wrote: Did you file this as a bug? On Tue 23 Apr 2013 23:16:03 JST, Clark Gaebel wrote: I'm on 7.6.2, and it does. Oh no. - Clark On Tuesday, April 23, 2013, Tom Ellis wrote: On Tue

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-07-18 Thread Clark Gaebel
https://github.com/patperry/hs-monte-carlo/issues/9 On Thu, Jul 18, 2013 at 10:20 PM, Clark Gaebel cgae...@uwaterloo.ca wrote: Then I will. Going to double check on 7.6.3, first. Thanks for bringing this back to my attention. I forgot about it. :P Regards, - Clark On Thu, Jul 18, 2013

Re: [Haskell-cafe] ordNub

2013-07-15 Thread Clark Gaebel
:54 AM, Clark Gaebel cgae...@uwaterloo.ca wrote: Oops sorry I guess my point wasn't clear. Why ord based when hashable is faster? Then there's no reason this has to be in base, it can just be a Did the point about stable fly overhead? -- brandon s allbery kf8nh

Re: [Haskell-cafe] ordNub

2013-07-15 Thread Clark Gaebel
I'm procrastinating something else, so I wrote the patch to unordered-containers. Feel free to comment on the github link: https://github.com/tibbe/unordered-containers/pull/67 I'm still against having an Ord version, since my intuition tells me that hash-based data structures are faster than

Re: [Haskell-cafe] ordNub

2013-07-15 Thread Clark Gaebel
! - Clark On Mon, Jul 15, 2013 at 11:35 PM, Richard A. O'Keefe o...@cs.otago.ac.nz wrote: On 16/07/2013, at 3:21 PM, Clark Gaebel wrote: I'm still against having an Ord version, since my intuition tells me that hash-based data structures are faster than ordered ones. There are at least

Re: [Haskell-cafe] ordNub

2013-07-14 Thread Clark Gaebel
Similarly, I've always used: import qualified Data.HashSet as S nub :: Hashable a = [a] - [a] nub = S.toList . S.fromList And i can't think of any type which i can't write a Hashable instance, so this is extremely practical. On Jul 14, 2013 7:24 AM, Niklas Hambüchen m...@nh2.me wrote: tldr:

Re: [Haskell-cafe] ordNub

2013-07-14 Thread Clark Gaebel
Oops sorry I guess my point wasn't clear. Why ord based when hashable is faster? Then there's no reason this has to be in base, it can just be a free function in Data.HashSet. If stability is a concern then there's a way to easily account for that using HashMap. - Clark On Jul 14, 2013 7:48

Re: [Haskell-cafe] Efficiency/Evaluation Question

2013-06-15 Thread Clark Gaebel
Yes. In general, GHC won't CSE for you. - Clark On Saturday, June 15, 2013, Christopher Howard wrote: On 06/15/2013 04:39 PM, Tommy Thorn wrote: There's not enough context to answer the specific question, but lazy evaluation isn't magic and the answer is probably no. Tommy

Re: [Haskell-cafe] Array, Vector, Bytestring

2013-06-03 Thread Clark Gaebel
How is this a problem? If you're representing text, use 'text'. If you're representing a string of bytes, use 'bytestring'. If you want an array of values, think c++ and use 'vector'. If you want to mutate arrays, first, make sure you do. You probably don't. If you're sure, use MVector. Don't

Re: [Haskell-cafe] Array, Vector, Bytestring

2013-06-03 Thread Clark Gaebel
, June 3, 2013, Jason Dagit wrote: On Mon, Jun 3, 2013 at 7:45 PM, Clark Gaebel cgae...@uwaterloo.cajavascript:; wrote: How is this a problem? If you're representing text, use 'text'. If you're representing a string of bytes, use 'bytestring'. If you want an array of values, think c

Re: [Haskell-cafe] Call for Papers IFL 2013

2013-05-31 Thread Clark Gaebel
Well that's exciting! I really hope uu finds a student. This would be yet another one of Haskell's killer features. - Clark On Friday, May 31, 2013, wrote: === VACANCY : 1x Phd Student in domain specific type error

Re: [Haskell-cafe] hackage update brigade (was Re: ANNOUNCE: new bridge! (prelude-prime))

2013-05-27 Thread Clark Gaebel
I'd be down for helping update packages when the time comes. On May 27, 2013 12:08 PM, Evan Laforge qdun...@gmail.com wrote: Yes, it would break code. Probably a lot of code. So of course I volunteer to fix my code, but that's not much help, since it's a small minority of the code on

Re: [Haskell-cafe] Non-deterministic behaviour of aeson's parser

2013-05-18 Thread Clark Gaebel
CNR with aeson 0.6.1.0 and ghc 7.6.3. pkg-list output can be found at http://pastebin.com/Zuuujcaz On Saturday, May 18, 2013, Niklas Hambüchen wrote: Can't reproduce: % ./aeson | sort | uniq -c 2000 Right () % ./aeson | sort | uniq -c 2000 Right () % ./aeson | sort | uniq -c

Re: [Haskell-cafe] Non-deterministic behaviour of aeson's parser

2013-05-18 Thread Clark Gaebel
$ uname -a Linux clark-laptop 3.9.0-2-ARCH #1 SMP PREEMPT Tue Apr 30 09:48:29 CEST 2013 x86_64 GNU/Linux It'd take too long for my helpfulness to build with cabal install -fsse2 hashable and rebuild an environment. If someone writes a bash script to do it (using cabal-dev please!), I'd be more

Re: [Haskell-cafe] Parallel ghc --make

2013-05-15 Thread Clark Gaebel
It's also useful to note that the disk cache might do a surprisingly good job at caching those .hi files for you. That, and a lot of people (like me!) use SSDs, where the parallel compilation takes the vast majority of time. I'd be really excited to see parallel ghc --make. By the way, totally

Re: [Haskell-cafe] Parallel ghc --make

2013-05-15 Thread Clark Gaebel
Oh! That works quite nicely. It's not supported for install-deps. I assumed that it just wasn't implemented. I should open a ticket. Thanks! - Clark On Wednesday, May 15, 2013, Clark Gaebel wrote: It's also useful to note that the disk cache might do a surprisingly good job at caching

[Haskell-cafe] Where is haskell-platform?

2013-05-10 Thread Clark Gaebel
I'm looking for the version of haskell platform that was supposed to be released May 6. It seems like it isn't out yet. What's preventing this from happening, and is there anything I can do to help? Regards, - Clark ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Hackage checking maintainership of packages

2013-05-06 Thread Clark Gaebel
Deepseq comes to mind regarding a perfect package that doesn't require active maintenance. - Clark On Mon, May 6, 2013 at 2:21 PM, Petr Pudlák petr@gmail.com wrote: 2013/5/6 Tillmann Rendel ren...@informatik.uni-marburg.de Petr Pudlák wrote: -- Forwarded message

Re: [Haskell-cafe] Hackage checking maintainership of packages

2013-05-05 Thread Clark Gaebel
fails to compile for x-time! That way we're SURE it's unmaintained. I'll stop sending emails now. On Mon, May 6, 2013 at 10:44 AM, Clark Gaebel cgae...@uwaterloo.cawrote: If there's a github link in the package url, it could check the last update to the default branch. If it's more than 6

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-04-23 Thread Clark Gaebel
I'm on 7.6.2, and it does. Oh no. - Clark On Tuesday, April 23, 2013, Tom Ellis wrote: On Tue, Apr 23, 2013 at 09:36:04AM +0200, Petr Pudlák wrote: I tested it on GHC 6.12.1, which wasn't affected by the recent ackermann bug, but still it leaks memory. I tested it on GHC 7.4.1 and I

[Haskell-cafe] Monad Transformer Space Leak

2013-04-22 Thread Clark Gaebel
Hi everyone! For some reason, this leaks thunks: module Main where import Control.Monad import Control.Monad.MC -- from monte-carlo import Control.Monad.ST.Strict go :: Int - MCT (ST s) () go k = replicateM_ k (return ()) main = print $ runST $ evalMCT (go 1) rng where rng

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-04-22 Thread Clark Gaebel
More interestingly, the problem goes away if I enable profiling. That's kind of worrisome. - Clark On Monday, April 22, 2013, Clark Gaebel wrote: Hi everyone! For some reason, this leaks thunks: module Main where import Control.Monad import Control.Monad.MC -- from monte-carlo import

Re: [Haskell-cafe] Monad Transformer Space Leak

2013-04-22 Thread Clark Gaebel
:44 -0400 schrieb Clark Gaebel: More interestingly, the problem goes away if I enable profiling. That's kind of worrisome. this part sounds similar than the recently discussed problem with the ackermann function (http://hackage.haskell.org/trac/ghc/ticket/7850) – maybe your code is only

Re: [Haskell-cafe] primitive operations in StateT

2013-04-16 Thread Clark Gaebel
*sigh* nevermind. I found it. Turns out there was: liftMCT :: (Monad m) = MC a - MCT m a in an unexported module in the monte-carlo package all along. I just need to export it and I'll be good to go. Thanks for your help! - Clark On Tuesday, April 16, 2013, Clark Gaebel wrote: The monad

Re: [Haskell-cafe] trying to understand out of memory exceptions

2013-04-16 Thread Clark Gaebel
See the comment for hGetContents: This function reads chunks at a time, doubling the chunksize on each read. The final buffer is then realloced to the appropriate size. For files half of available memory, this may lead to memory exhaustion. Consider using

Re: [Haskell-cafe] trying to understand out of memory exceptions

2013-04-16 Thread Clark Gaebel
- IO ByteStringreadFile f = bracket (openFile f ReadMode) hClose(\h - hFileSize h = hGet h . fromIntegral) which wont work on a special file, like a socket. which is what i am trying to simulate here. On Tue, Apr 16, 2013 at 11:28 AM, Clark Gaebel cg.wowus...@gmail.comjavascript:_e

[Haskell-cafe] primitive operations in StateT

2013-04-15 Thread Clark Gaebel
Hi list! I want to use MVectors in a StateT monad transformer. How do I do that? StateT isn't a member of 'PrimMonad', and I have no idea how to make it one. Regards, - Clark ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] primitive operations in StateT

2013-04-15 Thread Clark Gaebel
a - MCT (ST s) a but I know of no such function, and the second one would work if I had some way of making StateT a member of PrimMonad. Can I see an example with 'lift'? - Clark On Tuesday, April 16, 2013, Ivan Lazar Miljenovic wrote: On 16 April 2013 15:04, Clark Gaebel cgae

Re: [Haskell-cafe] multivariate normal distribution in Haskell?

2013-04-14 Thread Clark Gaebel
Is [1] what you're looking for (see the 'multinormal' function)? monte-carlo's pretty great... :) - Clark [1] http://hackage.haskell.org/packages/archive/monte-carlo/0.4.2/doc/html/Control-Monad-MC-Class.html#t:RNG On Sat, Apr 13, 2013 at 9:26 AM, Bas de Haas w.b.deh...@uu.nl wrote: Dear

Re: [Haskell-cafe] Type level natural numbers

2013-04-03 Thread Clark Gaebel
Where is [1]? On Wed, Apr 3, 2013 at 3:42 PM, Mateusz Kowalczyk fuuze...@fuuzetsu.co.ukwrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 About two weeks ago we got an email (at ghc-users) mentioning that comparing to 7.6, 7.7.x snapshot would contain (amongst other things), type level

Re: [Haskell-cafe] A Thought: Backus, FP, and Brute Force Learning

2013-03-20 Thread Clark Gaebel
Reading papers might not be the best way to get started with Haskell. It'll be a great way to expand your knowledge later, but they're generally not written to give the reader an introduction to functional programming. I highly recommend Learn You A Haskell [1]. It is extremely well written.

Re: [Haskell-cafe] ANN: Nomyx 0.1 beta, the game where you can change the rules

2013-02-27 Thread Clark Gaebel
You could just hash it. - Clark On Wed, Feb 27, 2013 at 2:08 PM, Corentin Dupont corentin.dup...@gmail.comwrote: So I need to encrypt the user ID in some way? What I need is to associate the user ID to a random number and store the association is a table? On Wed, Feb 27, 2013 at 3:52

Re: [Haskell-cafe] why no replace function in our regular expression libs ?

2013-01-25 Thread Clark Gaebel
I've needed this recently, too. End result: I wrote an Attoparsec.Parser Text, and ran the text through that. A regex would have been much nicer... - Clark On Fri, Jan 25, 2013 at 2:06 PM, Simon Michael si...@joyful.com wrote: People have put a lot of work into regular expression

Re: [Haskell-cafe] Documentation operator

2012-12-27 Thread Clark Gaebel
I love the idea, but it seems like it's a bit too early in Haskell's life to implement it. Not everyone's on GHC 7.6.1+. - Clark On Thu, Dec 27, 2012 at 3:20 PM, Iavor Diatchki iavor.diatc...@gmail.comwrote: Hi, I think that this is a neat idea that should be explored more! GHC's

Re: [Haskell-cafe] containers license issue

2012-12-17 Thread Clark Gaebel
So I heard back from softwarefreedom.org, and they're looking for a representative from haskell.org to talk to them, as they want to avoid conflict-of-interests with other clients. Does anyone with any official status want to talk to real lawyers about this issue, then let the list know of

Re: [Haskell-cafe] edge: compile testing

2012-12-14 Thread Clark Gaebel
The OpenAL bindings aren't building for me on GHC 7.6: Sound/OpenAL/ALC/QueryUtils.hs:66:1: Unacceptable argument type in foreign declaration: ALCdevice When checking declaration: foreign import ccall unsafe static alcGetString alcGetString :: ALCdevice - ALCenum - IO (Ptr

Re: [Haskell-cafe] LGPL and Haskell (Was: Re: ANNOUNCE: tie-knot library)

2012-12-13 Thread Clark Gaebel
Outside of the Valley and FOSS movement, programs are still usually distributed as binaries. For example, I have a secret, dirty desire to write a game in Haskell. This would be closed source, and if I'd have to rewrite most of the supporting libraries, it would be a nonstarter. Plus, it's hard

Re: [Haskell-cafe] Kernel Loops in Accelerate

2012-12-13 Thread Clark Gaebel
of sequential iteration to efficient GPU code. Additional thoughts/comments welcome! Cheers, -Trev [1]: https://github.com/AccelerateHS/accelerate-examples/tree/master/examples/mandelbrot On 12/12/2012, at 4:34 PM, Clark Gaebel cgae...@uwaterloo.ca wrote: Hi Trevor (and cafe), I've been

Re: [Haskell-cafe] containers license issue

2012-12-13 Thread Clark Gaebel
I didn't even know that site existed. Let's add them to the thread! softwarefreedom.org, what are your opinions on what was discussed in this thread: http://www.haskell.org/pipermail/haskell-cafe/2012-December/105193.html Is there anything that we, as a community, should know about? Should we

Re: [Haskell-cafe] LGPL and Haskell (Was: Re: ANNOUNCE: tie-knot library)

2012-12-12 Thread Clark Gaebel
Since we've already heard from the aggressive (L)GPL side of this debate, I think it's time for someone to provide the opposite opinion. I write code to help users. However, as a library designer, my users are programmers just like me. Writing my Haskell libraries with restrictions like the

Re: [Haskell-cafe] containers license issue

2012-12-12 Thread Clark Gaebel
I think this is a potential problem, but, obviously, IANAL. [1] According to the GPL: To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or

Re: [Haskell-cafe] containers license issue

2012-12-12 Thread Clark Gaebel
is a propagation of the original work). Algorithms are not covered by copyright. 2012/12/12 Clark Gaebel cgae...@uwaterloo.ca: I think this is a potential problem, but, obviously, IANAL. [1] According to the GPL: To “propagate” a work means to do anything with it that, without permission

Re: [Haskell-cafe] containers license issue

2012-12-12 Thread Clark Gaebel
Just for reference: In Data/IntMap/Base.hs highestBitMask :: Nat - Nat highestBitMask x0 = case (x0 .|. shiftRL x0 1) of x1 - case (x1 .|. shiftRL x1 2) of x2 - case (x2 .|. shiftRL x2 4) of x3 - case (x3 .|. shiftRL x3 8) of x4 - case (x4 .|. shiftRL x4 16) of #if

Re: [Haskell-cafe] containers license issue

2012-12-12 Thread Clark Gaebel
I just did a quick derivation from http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 to get the highest bit mask, and did not reference FXT nor the containers implementation. Here is my code: highestBitMask :: Word64 - Word64 highestBitMask x1 = let x2 = x1 .|. x1 `shiftR` 1

Re: [Haskell-cafe] containers license issue

2012-12-12 Thread Clark Gaebel
Possibly. I tend to trust GHC's strictness analyzer until proven otherwise, though. Feel free to optimize as necessary. - Clark On Wed, Dec 12, 2012 at 3:06 PM, Vo Minh Thu not...@gmail.com wrote: 2012/12/12 Johan Tibell johan.tib...@gmail.com: On Wed, Dec 12, 2012 at 10:40 AM, Clark

Re: [Haskell-cafe] Control.bimap?

2012-12-12 Thread Clark Gaebel
http://hackage.haskell.org/packages/archive/categories/0.59/doc/html/Control-Categorical-Bifunctor.html On Wed, Dec 12, 2012 at 3:54 PM, Gregory Guthrie guth...@mum.edu wrote: I found a nice idiom for a graph algorithm where the pairs of nodes representing links could be merged into node

Re: [Haskell-cafe] Control.bimap?

2012-12-12 Thread Clark Gaebel
Also, http://hackage.haskell.org/packages/archive/bifunctors/3.0/doc/html/Data-Bifunctor.html On Wed, Dec 12, 2012 at 4:12 PM, Clark Gaebel cgae...@uwaterloo.ca wrote: http://hackage.haskell.org/packages/archive/categories/0.59/doc/html/Control-Categorical-Bifunctor.html On Wed, Dec 12

Re: [Haskell-cafe] C++

2012-12-11 Thread Clark Gaebel
If you're trying to memoize a recursive algorithm with a global array of previous states, you could use the marvellous MemoTrie package [1]. It lets you write your algorithm recursively, while getting all the benefits of memoization! Here's an example with the fibonacci function: fib :: Int -

[Haskell-cafe] Kernel Loops in Accelerate

2012-12-11 Thread Clark Gaebel
Hi Trevor (and cafe), I've been playing more and more with accelerate, and I find it quite annoying that there are no loops. It makes implementing many algorithms much harder than it should be. For example, I would love to submit a patch to fix issue #52 [0] on github by implementing MWC64X [1],

Re: [Haskell-cafe] Is it possible to have constant-space JSON decoding?

2012-12-04 Thread Clark Gaebel
Aeson is used for the very common usecase of short messages that need to be parsed as quickly as possible into a static structure. A lot of things are sacrificed to make this work, such as incremental parsing and good error messages. It works great for web APIs like twitter's. I didn't even know

Re: [Haskell-cafe] Is hackage.haskell.org down?

2012-12-04 Thread Clark Gaebel
Works for me. On Tue, Dec 4, 2012 at 11:03 AM, Niklas Hambüchen m...@nh2.me wrote: Down for me. On Tue 04 Dec 2012 15:44:10 GMT, Ivan Perez wrote: Hi haskellers, I've been having problems to access hackage.haskell.org for the past 2-4 hours. Is everything ok? Cheers, Ivan

Re: [Haskell-cafe] Naive matrix multiplication with Accelerate

2012-12-04 Thread Clark Gaebel
, it is difficult for me to visualise as well. I do the same sort of trick with the n-body demo to get all n^2 particle interactions. -Trev [1]: http://en.wikipedia.org/wiki/Outer_product#Vector_multiplication On 04/12/2012, at 3:41 AM, Clark Gaebel cgae...@uwaterloo.ca wrote: Ah. I

Re: [Haskell-cafe] Naive matrix multiplication with Accelerate

2012-12-04 Thread Clark Gaebel
on the subject. For example, https://www.coursera.org/course/matrix On Tue, Dec 4, 2012 at 4:13 PM, Clark Gaebel cgae...@uwaterloo.cawrote: No. But that doesn't stop me from being curious with Accelerate. Might you have a better explaination for what's happening here than Trevor's? - Clark

Re: [Haskell-cafe] Naive matrix multiplication with Accelerate

2012-12-03 Thread Clark Gaebel
On 03/12/2012, at 5:07 PM, Clark Gaebel cgae...@uwaterloo.ca wrote: Hello cafe, I've recently started learning about cuda and hetrogenous programming, and have been using accelerate [1] to help me out. Right now, I'm running into trouble in that I can't call parallel code from sequential code

[Haskell-cafe] Naive matrix multiplication with Accelerate

2012-12-02 Thread Clark Gaebel
Hello cafe, I've recently started learning about cuda and hetrogenous programming, and have been using accelerate [1] to help me out. Right now, I'm running into trouble in that I can't call parallel code from sequential code. Turns out GPUs aren't exactly like Repa =P. Here's what I have so

Re: [Haskell-cafe] To my boss: The code is cool, but it is about 100 times slower than the old one...

2012-11-29 Thread Clark Gaebel
If you can give an example of some underperforming code, I'm sure someone (or several people) on this list would be more than happy to help you make it more performant. Generally, it doesn't take much. It's all in knowing where to look. Also, if you know performance is key, you should be using

Re: [Haskell-cafe] How to incrementally update list

2012-11-28 Thread Clark Gaebel
Here's a version that works: *import Control.DeepSeq* list = [1,2,3,4,5] advance l = *force $* map (\x - x+1) l run 0 s = s run n s = run (n-1) $ advance s main = do let s = run 5000 list putStrLn $ show s The problem is that you build of a huge chain of updates to the

Re: [Haskell-cafe] Cabal failures...

2012-11-20 Thread Clark Gaebel
+1 to this. The friction of finding, setting up, and using Windows isn't even comparable to just sshing into another unix box and testing something quickly. As a university student, I also find it relatively rare that I get to test on a Windows machine. My personal computer runs linux, my

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-14 Thread Clark Gaebel
To prevent this, I think the PVP should specify that if dependencies get a major version bump, the package itself should bump its major version (preferably the B field). Hopefully, in the future, cabal would make a distinction between packages * used* within another package (such as a hashmap

Re: [Haskell-cafe] Quickcheck

2012-11-13 Thread Clark Gaebel
Your implication is backwards. == is read implies So your way has do blah with positive integers implies x 0 y 0. That's backwards. Try prop_something x y = x 0 y 0 == ... do blah with positive integers - Clark On Tue, Nov 13, 2012 at 4:52 PM, gra...@fatlazycat.com wrote: Thanks,

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-09 Thread Clark Gaebel
What I usually do is start out with dependencies listed like: aeson ==0.6.* and then, as your dependencies evolve, you either bump the version number: aeson ==0.7.* or, if you're willing to support multiple version, switch to a range: aeson =0.6 = 0.7 If someone uses a previous version of a

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-09 Thread Clark Gaebel
2012, Clark Gaebel napisał: What I usually do is start out with dependencies listed like: aeson ==0.6.* and then, as your dependencies evolve, you either bump the version number: aeson ==0.7.* or, if you're willing to support multiple version, switch to a range: aeson =0.6

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-09 Thread Clark Gaebel
Dnia piątek, 9 listopada 2012, Clark Gaebel napisał: What I usually do is start out with dependencies listed like: aeson ==0.6.* and then, as your dependencies evolve, you either bump the version number: aeson ==0.7.* or, if you're willing to support multiple

Re: [Haskell-cafe] How to determine correct dependency versions for a library?

2012-11-09 Thread Clark Gaebel
I think we just use dependencies different things. This is a problem inherent in cabal. When I (and others) specify a dependency, I'm saying My package will work with these packages. I promise. When you (and others) specify a dependency, you're saying If you use a version outside of these bounds,

Re: [Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-06 Thread Clark Gaebel
, anyway. - Clark On Tue, Nov 6, 2012 at 6:31 AM, Herbert Valerio Riedel h...@gnu.org wrote: Clark Gaebel cgae...@uwaterloo.ca writes: How would the ghc-dependance affect hashable's inclusion in the haskell platform? Doesn't the haskell platform ship only a recent version of ghc (i.e. one

Re: [Haskell-cafe] Defining a Strict language pragma

2012-11-06 Thread Clark Gaebel
What if the strict code were to assume nothing is ever _|_, and result in undefined behavior if it is? Kind of like a NULL pointer in C. On Tue, Nov 6, 2012 at 8:36 AM, Jan-Willem Maessen jmaes...@alum.mit.eduwrote: On Mon, Nov 5, 2012 at 5:52 PM, Johan Tibell johan.tib...@gmail.comwrote:

[Haskell-cafe] [ANNOUNCE] network-bitcoin

2012-11-05 Thread Clark Gaebel
Hello Cafe, You've heard of the neat crypto-currency bitcoin[1], haven't you? Well, I've just released network-bitcoin[2] which provides Haskell bindings to the bitcoin daemon. Hopefully, this will make your bitcoin-related goals easier to achieve. Who knows, it might even make bitcoin

Re: [Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-04 Thread Clark Gaebel
Thanks a lot! I've updated the benchmark accordingly, and have released a new version without the 1.3x slowdown disclaimer as generic-hashable 1.1.8. - Clark On Sun, Nov 4, 2012 at 10:25 AM, Herbert Valerio Riedel h...@gnu.org wrote: Clark Gaebel cgae...@uwaterloo.ca writes: [...] Oh

Re: [Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-04 Thread Clark Gaebel
@dag: I would love for this to be merged into Data.Hashable, and I think it would make a lot of people's lives easier, and prevent them from writing bad hash functions accidentally. - Clark On Sun, Nov 4, 2012 at 10:30 AM, dag.odenh...@gmail.com dag.odenh...@gmail.com wrote: Have you

Re: [Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-04 Thread Clark Gaebel
Yes. Sorry if I wasn't clear. That's what I intended. So would a patch adding this to hashable be accepted? - Clark On Sun, Nov 4, 2012 at 11:39 AM, Johan Tibell johan.tib...@gmail.comwrote: On Sun, Nov 4, 2012 at 8:35 AM, Clark Gaebel cgae...@uwaterloo.ca wrote: @dag: I would love

Re: [Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-04 Thread Clark Gaebel
How would the ghc-dependance affect hashable's inclusion in the haskell platform? Doesn't the haskell platform ship only a recent version of ghc (i.e. one with support for generics)? - Clark On Nov 4, 2012 6:00 PM, Herbert Valerio Riedel h...@gnu.org wrote: Clark Gaebel cgae...@uwaterloo.ca

[Haskell-cafe] [ANNOUNCE] hashable-generics

2012-11-02 Thread Clark Gaebel
Hi everybody! I have just released a handy package on Hackage that will interest you if you've ever used unordered-containers with a custom type. In order to do such a thing, you'd need to define an instance of Hashable. This process could easily be automated. And so I did. {-# LANGUAGE

Re: [Haskell-cafe] Building all possible element combinations from N lists.

2012-10-28 Thread Clark Gaebel
Golfed: http://en.wikipedia.org/wiki/Code_golf = : Also known as Kleisli composition. More info: http://www.haskell.org/hoogle/?hoogle=%3C%3D%3C On Sun, Oct 28, 2012 at 4:36 PM, dokondr doko...@gmail.com wrote: On Fri, Oct 26, 2012 at 2:34 AM, Jake McArthur jake.mcart...@gmail.comwrote: I

Re: [Haskell-cafe] GHC maintenance on Arch

2012-10-28 Thread Clark Gaebel
Personally, I like the latest version of GHC being in the repository, as that's the version I normally use. What packages aren't working for you on 7.6? I find that they get updated pretty quickly, and if you run into any that aren't, feel free to send the authors a pull request. Almost

Re: [Haskell-cafe] [Security] Put haskell.org on https

2012-10-28 Thread Clark Gaebel
Do it at home. If you're at an internet cafe, though, it'd be nice if you could trust cabal packages. - Clark On Sun, Oct 28, 2012 at 5:07 PM, Patrick Hurst phu...@amateurtopologist.com wrote: On Oct 28, 2012, at 4:38 PM, Changaco chang...@changaco.net wrote: On Sun, 28 Oct 2012

Re: [Haskell-cafe] referential transparency? (for fixity of local operators)

2012-10-05 Thread Clark Gaebel
Compile with -Wall and the flaw becomes obvious: interactive:2:5: Warning: This binding for `+' shadows the existing binding imported from `Prelude' (and originally defined in `GHC.Num') interactive:2:9: Warning: This binding for `*' shadows the existing binding

Re: [Haskell-cafe] a parallel mapM?

2012-10-03 Thread Clark Gaebel
I'm not sure that exposing a liftIO for Monad.Par is the best idea. Since all these parallel computations use runPar :: Par a - a, it advertises that the result is deterministic. I'm not really comfortable with a hidden unsafePerformIO hiding in the background. That said, I don't see a reason for

Re: [Haskell-cafe] Improvement suggestions

2012-08-15 Thread Clark Gaebel
Try: concat . intersperse \n $ (sequence $ map loop docs) On Wed, Aug 15, 2012 at 11:01 AM, José Lopes jose.lo...@ist.utl.pt wrote: Hello everyone, I am quite new to monadic code so I would like to ask for improvement suggestions on the last line of the code below. I know I could do

Re: [Haskell-cafe] Sorting efficiency

2012-08-04 Thread Clark Gaebel
It's generally not advisable to use Data.List for performance-sensitive parts of an application. Try using Data.Vector instead: http://hackage.haskell.org/package/vector On Sat, Aug 4, 2012 at 11:23 AM, David Feuer david.fe...@gmail.com wrote: I'm writing a toy program (for a SPOJ problem--see

Re: [Haskell-cafe] Knight Capital debacle and software correctness

2012-08-04 Thread Clark Gaebel
Yes. On Sat, Aug 4, 2012 at 1:47 PM, Jay Sulzberger j...@panix.com wrote: On Sat, 4 Aug 2012, Jake McArthur jake.mcart...@gmail.com wrote: I feel like this thread is kind of surreal. Knight Capital's mistake was to use imperative programming styles? An entire industry is suffering

Re: [Haskell-cafe] Knight Capital debacle and software correctness

2012-08-04 Thread Clark Gaebel
As far as I know, you can't check equivalence of _|_. Since Haskell uses _|_ to represent a nonterminating computation, this would be synonymouswith solving the halting problem. On Sat, Aug 4, 2012 at 2:04 PM, Jay Sulzberger j...@panix.com wrote: On Sat, 4 Aug 2012, Clark Gaebel cgae

[Haskell-cafe] Confused by ghci output

2012-05-31 Thread Clark Gaebel
*X 3^40 `mod` 3 == modexp2 3 40 3 False *X modexp2 3 40 3 0 *X 3^40 `mod` 3 0 I'm confused. Last I checked, 0 == 0. Using GHC 7.4.1, and the file x.hs (which has been loaded in ghci) can be found here: http://hpaste.org/69342 I noticed this after prop_sanemodexp was failing. Any help would be

Re: [Haskell-cafe] Confused by ghci output

2012-05-31 Thread Clark Gaebel
Wow, thanks! That was subtle. - Clark On Thu, May 31, 2012 at 12:49 PM, Claude Heiland-Allen cla...@goto10.orgwrote: Hi Clark, ghci is defaulting to Integer modexp2 forces Int Int overflows with 3^40 On 31/05/12 17:35, Clark Gaebel wrote: *X 3^40 `mod` 3 == modexp2 3 40 3 False

Re: [Haskell-cafe] Confused by ghci output

2012-05-31 Thread Clark Gaebel
The cafe is certainly responsive today! Thanks everyone - got it. Integer overflow ;) Regards, - Clark ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Need inputs for a Haskell awareness presentation

2012-05-31 Thread Clark Gaebel
Regarding 2d, Debug.Trace is perfect for that. On Thu, May 31, 2012 at 2:23 PM, C K Kashyap ckkash...@gmail.com wrote: Hi folks, I have the opportunity to make a presentation to folks (developers and managers) in my organization about Haskell - and why it's important - and why it's the only

Re: [Haskell-cafe] Large graphs

2012-05-20 Thread Clark Gaebel
I had issues with FGL in the past, too. Although FGL is really nice to work with, it just uses a ridiculous amount of memory for large graphs. In the end, I used Data.Graph from containers [1]. This was a lot more reasonable, and let me finish my project relatively easily. Regards, - Clark

[Haskell-cafe] Conduits and Unix Pipes

2012-04-07 Thread Clark Gaebel
Has anyone built an adapter between unix pipes and conduits? Something like: upipe2conduit :: String - Conduit Char Char let someLines = hello\nworld nLines - (read . runResourceT $ sourceList someLines $= upipe2conduit wc -l $$ consume) :: Integer If this has been done, is it on hackage?

Re: [Haskell-cafe] Conduits and Unix Pipes

2012-04-07 Thread Clark Gaebel
Well look at that. Thanks! On Sat, Apr 7, 2012 at 1:49 PM, Bin Jin bjin1...@gmail.com wrote: I think process-conduit is what you are looking for. On Apr 8, 2012 1:22 AM, Clark Gaebel cgae...@uwaterloo.ca wrote: Has anyone built an adapter between unix pipes and conduits? Something like

Re: [Haskell-cafe] thread killed

2012-04-04 Thread Clark Gaebel
Whenever I've deadlocked, it terminated the program with thread blocked indefinitely in an MVar operation. On Wed, Apr 4, 2012 at 5:59 PM, tsuraan tsur...@gmail.com wrote: My Snap handlers communicate with various resource pools, often through MVars.  Is it possible that MVar deadlock would be

[Haskell-cafe] Stack overflow while programming imperatively

2012-03-18 Thread Clark Gaebel
Hey list. I was recently fixing a space leak by dropping down to imperative programming in a section of my code, when it started developing space leaks of its own. I found the problem though - it was my for loop: http://hpaste.org/65514 Can anyone provide suggestions on why that stack

Re: [Haskell-cafe] Stack overflow while programming imperatively

2012-03-18 Thread Clark Gaebel
Yay, that fixed it. Thanks! On Sun, Mar 18, 2012 at 2:50 PM, Aleksey Khudyakov alexey.sklad...@gmail.com wrote: On 18.03.2012 22:32, Clark Gaebel wrote: Hey list. I was recently fixing a space leak by dropping down to imperative programming in a section of my code, when it started

Re: [Haskell-cafe] Global Arrays

2012-03-12 Thread Clark Gaebel
Is there any proof of this? I'm not familiar enough with core to check. On Mon, Mar 12, 2012 at 3:48 AM, Ketil Malde ke...@malde.org wrote: Clark Gaebel cgae...@csclub.uwaterloo.ca writes: In Haskell, what's the canonical way of declaring a top-level array (Data.Vector of a huge list

Re: [Haskell-cafe] Global Arrays

2012-03-10 Thread Clark Gaebel
марта 2012 г. 5:05 пользователь John Meacham j...@repetae.net написал: On Fri, Mar 9, 2012 at 5:49 PM, Clark Gaebel cgae...@csclub.uwaterloo.ca wrote: What's the advantage of using D.A.Storable over D.Vector? And yes, good call with creating an array of HSDouble directly. I didn't think

[Haskell-cafe] Global Arrays

2012-03-09 Thread Clark Gaebel
In Haskell, what's the canonical way of declaring a top-level array (Data.Vector of a huge list of doubles, in my case)? Performance is key in my case. The straightforward way would just be something like: globalArray :: V.Vector Double globalArray = V.fromList [ huge list of doubles ] {-#

Re: [Haskell-cafe] Global Arrays

2012-03-09 Thread Clark Gaebel
What's the advantage of using D.A.Storable over D.Vector? And yes, good call with creating an array of HSDouble directly. I didn't think of that! On Fri, Mar 9, 2012 at 8:25 PM, John Meacham j...@repetae.net wrote: On Fri, Mar 9, 2012 at 12:48 PM, Clark Gaebel cgae...@csclub.uwaterloo.ca wrote

[Haskell-cafe] Double-dispatch

2012-03-05 Thread Clark Gaebel
Is there any way in Haskell to have the correct function selected based on the types of two different types? For example, let's say I'm writing intersection tests: aABBandAABB :: AABB - AABB - Bool oBBandOBB :: OBB - OBB - Bool oBBandPoint :: OBB - Point - Bool Is there some way (such as with

Re: [Haskell-cafe] Double-dispatch

2012-03-05 Thread Clark Gaebel
Well look at that. Thanks! On Mon, Mar 5, 2012 at 4:07 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: {-# LANGUAGE MultiParamTypeClasses #-} class Intersectable a b where  intersectsWith :: a - b - Bool -- Felipe. ___ Haskell-Cafe

Re: [Haskell-cafe] Double-dispatch

2012-03-05 Thread Clark Gaebel
ng thornton w...@freegeek.org wrote: On 3/5/12 4:24 PM, Clark Gaebel wrote: Well look at that. Thanks! On Mon, Mar 5, 2012 at 4:07 PM, Felipe Almeida Lessa felipe.le...@gmail.com  wrote: {-# LANGUAGE MultiParamTypeClasses #-} class Intersectable a b where  intersectsWith :: a -  b

  1   2   >