Re: [Haskell-cafe] attoparsec double precision, quickCheck and aeson

2012-06-05 Thread Warren Harris
On Jun 5, 2012, at 10:51 AM, Bryan O'Sullivan wrote: > On Tue, Jun 5, 2012 at 9:12 AM, Warren Harris > wrote: > > which helps in many cases, but for some the parsing seems bi-stable, > alternating between two imprecise double values and causing the test to fail. > I

Re: [Haskell-cafe] attoparsec double precision, quickCheck and aeson

2012-06-05 Thread Warren Harris
On Jun 5, 2012, at 9:57 AM, Johan Tibell wrote: > I don't think applying == to something that contains floating point > values at the leaves makes much sense. You want some approxEq function > that uses approximate equality on floating point value or you want to > equality function that ignores t

Re: [Haskell-cafe] attoparsec double precision, quickCheck and aeson

2012-06-05 Thread Warren Harris
On Jun 5, 2012, at 9:38 AM, Johan Tibell wrote: > You want to perform your test as > >d1 - d2 < epsilon What's the best way to do this though, since aeson's Value type already provides instance Eq? I guess I can write my own suite of equality comparisons, but these aeson values are the lea

[Haskell-cafe] attoparsec double precision, quickCheck and aeson

2012-06-05 Thread Warren Harris
The double parser provided by Data.Attoparsec.ByteString.Char8 looses precision around the 13-15th decimal place (http://hackage.haskell.org/packages/archive/attoparsec/0.10.2.0/doc/html/Data-Attoparsec-ByteString-Char8.html#v:double). Unfortunately this reeks havoc with my attempts to write a q

Re: [Haskell-cafe] using ResourceT with MVars

2012-05-02 Thread Warren Harris
On May 2, 2012, at 2:06 AM, Michael Snoyman wrote: > > I don't really know the details of LevelDB, but if the question is > "how do I run MVar operations in ResourceT", yes > the answer would be > lifted-base[1]. Since ResourceT is an instance of MonadBaseControl, > you can use any of the func

[Haskell-cafe] using ResourceT with MVars

2012-05-02 Thread Warren Harris
I would like to use LevelDB in my code, and the HEAD version of leveldb-haskell now uses runResourceT to manage open db connections and iterators. I would also like to run multiple threads, and coordinate them for transaction-like behavior, i.e. read and writing data without interruption. LevelD

Re: [Haskell-cafe] prettyprint with IO

2012-04-12 Thread Warren Harris
s. If you can take a look, I'd appreciate your suggestions. Warren On Apr 12, 2012, at 6:22 PM, Antoine Latter wrote: > Hi Warren, > > On Thu, Apr 12, 2012 at 6:31 PM, Warren Harris > wrote: >> I wrote a parsec parser that does symbols lookups during the parsing proce

[Haskell-cafe] prettyprint with IO

2012-04-12 Thread Warren Harris
I wrote a parsec parser that does symbols lookups during the parsing process (ParsecT String Store IO a). Now I'd like to write a pretty printer that does the reverse. Unfortunately there doesn't appear to be a transformer version of Text.PrettyPrint.HughesPJ. Can anyone suggest a way to do this

Re: [Haskell-cafe] haskell-platform vs macports

2012-03-22 Thread Warren Harris
wrote: > If you're not otherwise attached to MacPorts, you might want to check > out Homebrew [1]. Its integration with the rest of OS X is generally > more smoothly and I haven't come across any missing packages yet. > > [1]: http://mxcl.github.com/homebrew/ > > O

[Haskell-cafe] haskell-platform vs macports

2012-03-22 Thread Warren Harris
I assume that many haskell users out there on macs who are also users of macports, and I bet they've hit this same issue that I've hit numerous times. The problem is that there are 2 incompatible versions of libiconv -- one that ships with the mac, and one that's built with macports and that man

[Haskell-cafe] erratic behavior for System.Time.diffClockTimes

2011-04-08 Thread Warren Harris
I'm trying out GHC-7.0.3-x86_64 for Mac OS X and see what seems to be a bug in System.Time.diffClockTimes. The TimeDiff tdPicosec field returns values that seem to jump around erratically: test = do startTime <- System.Time.getClockTime endTime <- System.Time.getClockTime let dt = diffClo

Re: [Haskell-cafe] timely shutdown of timer threads

2011-02-02 Thread Warren Harris
On Feb 2, 2011, at 2:02 PM, Johan Tibell wrote: > On Wed, Feb 2, 2011 at 10:42 PM, Warren Harris > wrote: >> Interesting. I hadn't thought of this solution. You're forking the timer to >> yet a third thread so that if it continues waiting beyond the checkpoint &

Re: [Haskell-cafe] timely shutdown of timer threads

2011-02-02 Thread Warren Harris
to terminate before terminating the app. It still seems to me that haskell is lacking when it comes to operations that can wait for multiple conditions. Warren On Feb 1, 2011, at 6:25 PM, Albert Y. C. Lai wrote: > On 11-02-01 02:58 PM, Warren Harris wrote: >> I have an application

[Haskell-cafe] timely shutdown of timer threads

2011-02-01 Thread Warren Harris
I have an application that forks a thread to run an activity on a timer. (The activity happens to be Berkeley DB checkpointing, but that's actually beside the point here.) The problem is that when the application wants to quit, I would like my main thread to be able to tell the timer thread to s

Re: [Haskell-cafe] dph question

2010-10-15 Thread Warren Harris
Got it - thanks. Any idea about the run-away process problem? Thanks, Warren On Fri, Oct 15, 2010 at 9:32 AM, Daniel Fischer wrote: > On Friday 15 October 2010 14:59:18, Warren Harris wrote: > > I trying to learn a bit about data parallel haskell, and started from > > the

[Haskell-cafe] dph question

2010-10-15 Thread Warren Harris
I trying to learn a bit about data parallel haskell, and started from the wiki page here: http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell. Two questions: The examples express the dot product as: dotp_double xs ys = sumP [:x *

Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-05-01 Thread Warren Harris
On May 1, 2010, at 10:48 AM, Daniel Fischer wrote: Add a --constraint="base>=4" That should fix containers-0.2.0.1, but it might break something else. Sorry... $ cabal install --constraint="Crypto<4.2.1" -- constraint="HJScript<0.5" --constraint="base>=4" happs-tutorial Resolving depende

Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-05-01 Thread Warren Harris
On May 1, 2010, at 3:39 AM, Daniel Fischer wrote: Try $ cabal install --constraint="Crypto<4.2.1" -- constraint="HJScript<0.5" happs-tutorial This had the same problem building containers: Building containers-0.2.0.1... Data/IntMap.hs:182:7: Could not find module `Data.Data':

Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-05-01 Thread Warren Harris
On May 1, 2010, at 1:28 AM, Ivan Lazar Miljenovic wrote: Warren Harris writes: On May 1, 2010, at 12:08 AM, Alexander Solla wrote: I think that if you run this, you will satisfy all the dependencies: cabal install "hjscript<0.5.0" happstack Thank you. That worked. I

Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-05-01 Thread Warren Harris
On May 1, 2010, at 12:08 AM, Alexander Solla wrote: I think that if you run this, you will satisfy all the dependencies: cabal install "hjscript<0.5.0" happstack Thank you. That worked. I had a similar problem installing the happstack-tutorial, but found that I could work around it with t

Re: [Haskell-cafe] Build problems (hsp, trhsx, ultimately Happstack)

2010-04-30 Thread Warren Harris
I thought I'd install happstack to give it a try, but immediately hit the following build problem: $ cabal install happstack Resolving dependencies... cabal: cannot configure HJScript-0.5.0. It requires hsx >=0.7.0 For the dependency on hsx >=0.7.0 there are these packages: hsx-0.7.0. However

Re: [Haskell-cafe] haskell platform questions

2010-03-26 Thread Warren Harris
FWIW, downloading the haskell-platform-2010.1.0.0 tarball and building it on my 10.5.8 system (with ghc 6.12.1 installed from the dmg) worked just fine. Didn't take too long either. Unfortunately I don't see any telltale linker options in the build logs. Warren On Mar 26, 2010, at 7:38 AM

Re: [Haskell-cafe] haskell platform questions

2010-03-22 Thread Warren Harris
BTW, I started to try the macports method (thinking that maybe building on my machine would resolve the linker problem), but the package up there seems to be the old one: $ port info haskell-platform haskell-platform @2009.2.0.2 (devel, haskell) Description: This is the the Haskell

Re: [Haskell-cafe] haskell platform questions

2010-03-21 Thread Warren Harris
Best, John V. On Wed, Mar 17, 2010 at 09:07:03PM -0700, Warren Harris wrote: I installed haskell platform some time ago, and now I'm wondering what version I have. How do I find out? Also, when the new one comes along on the 21st, is there a way to upgrade? Or if I must first uninstal

[Haskell-cafe] haskell platform questions

2010-03-17 Thread Warren Harris
I installed haskell platform some time ago, and now I'm wondering what version I have. How do I find out? Also, when the new one comes along on the 21st, is there a way to upgrade? Or if I must first uninstall the one I have now, how do I uninstall it? Is it recommended to periodically up

[Haskell-cafe] buildExpressionParser prefix recursion

2009-12-01 Thread Warren Harris
I was wondering why Parsec's buildExpressionParser doesn't allow prefix expressions to be handled recursively, e.g. given a prefix "!" operation, it seems that "!!a" could parse without requiring parentheses ("!(!a)"). Is there an easy way to extend it? (I have a rich expression grammar I'd

Re: [Haskell-cafe] Time Typeable Instances

2009-10-21 Thread Warren Harris
Hi John, I just stumbled on this issue while trying to compile turbinado with the haskell platform / ghc 6.10.4. I got past it by manually editing back in the time definitions, but just wondering if there was an official resolution. Thanks, Warren On Oct 13, 2009, at 6:48 AM, John Goerz

Re: [Haskell-cafe] mapping large structures into memory

2009-09-25 Thread Warren Harris
On Sep 25, 2009, at 12:14 PM, Don Stewart wrote: It is entirely possible to use mmap to map structures into memory. Thanks to the foreign function interface, there are well-defined semantics for calling to and from C. The key questions would be: * what is the type and representation of the d

[Haskell-cafe] mapping large structures into memory

2009-09-25 Thread Warren Harris
I've dabbled in haskell, but am by no means an expert. I was hoping someone here could help me settle this debate so that we can more seriously consider haskell for a next version of an application we're building I would like to understand better what its capabilities are for directly

Re: [Haskell-cafe] Re: Haskell Logo write-in candidate

2009-03-20 Thread Warren Harris
monad/lambda symbol with its curved edges. I'd be happy to wear this one too though... actually, given what I said above, I'll be happy to wear any of them! Warren On Mar 20, 2009, at 2:17 AM, Jon Fairbairn wrote: Warren Harris writes: After spending a bit of time trying to decid

[Haskell-cafe] Haskell Logo write-in candidate

2009-03-19 Thread Warren Harris
After spending a bit of time trying to decide how to vote, I ended up deciding that my favorite would be a hybrid of several of the designs (#9 & #49 FalconNL, and #50 George Pollard). It's probably too late to include this in the voting, but here it is nonetheless: <> (My primary crite

Re: [Haskell-cafe] teaching functional programming at work

2009-01-10 Thread Warren Harris
Thank you all for your responses on this. These ideas/materials are very helpful. In particular, the John Harrison book looks excellent (http://www.cl.cam.ac.uk/teaching/Lectures/funprog-jrh-1996/index.html ) -- a comprehensive and understandable introduction to all the concepts I had in mind.

[Haskell-cafe] teaching functional programming at work

2009-01-03 Thread Warren Harris
I am seeking suggestions from the haskell cafe for teaching functional programming concepts to colleagues at work. I'm currently working on a project using ocaml and functional programming techniques, and am a lone ranger at my workplace when it comes to this sort of thing (we are primarily

Re: [Haskell-cafe] streaming translation using monads

2008-11-19 Thread Warren Harris
On Nov 19, 2008, at 12:19 PM, Justin Bailey wrote: On Wed, Nov 19, 2008 at 11:50 AM, Warren Harris <[EMAIL PROTECTED]> wrote: Now perhaps the in-memory list part was a bad conclusion since the queries can be decorated with translation functions capable of streaming the results

Re: [Haskell-cafe] streaming translation using monads

2008-11-19 Thread Warren Harris
On Nov 19, 2008, at 9:11 AM, Justin Bailey wrote: On Tue, Nov 18, 2008 at 6:23 PM, Warren Harris <[EMAIL PROTECTED] > wrote: I am working on a query language translator, and although I feel that a monadic formulation would work well for this application, I've stumbled on

Re: [Haskell-cafe] streaming translation using monads

2008-11-19 Thread Warren Harris
On Nov 18, 2008, at 6:53 PM, Brandon S. Allbery KF8NH wrote: On 2008 Nov 18, at 21:23, Warren Harris wrote: However, each of the clauses is actually an output routine to send the expression that it denotes to a remote server, and a parser for receiving the results. Since a clause is really

[Haskell-cafe] streaming translation using monads

2008-11-18 Thread Warren Harris
e projection of those values back into my program could lead to dynamic type errors, and also causes seemingly needless memory allocations. There must be another technique for this sort of streaming translation out there... I welcome any suggestions you might have! Warren Harris _