Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Magicloud Magiclouds
Sorry for the wrong information. I made a mistake when did the test. After more testing, I think it is a bug of ghc 7.4.1. Until now, I cannot find a way to make ghc 7.4.1 compiled binary work. On Mon, May 28, 2012 at 11:01 AM, Magicloud Magiclouds wrote: > Alright, with another box of different

Re: [Haskell-cafe] Building pattern and trying monads

2012-05-27 Thread Roman Cheplyaka
* L Corbijn [2012-05-27 14:21:39+0200] > The solution I've in mind depends on the stack being pure. When the > monad stack is pure a rule can be applied, returning a maybe value (or > having a MaybeT wrapper) and when returning Nothing (failed rule) > reverting the stack to it's point before apply

Re: [Haskell-cafe] A functional programming solution for Mr and Mrs Hollingberry

2012-05-27 Thread Alexander Solla
On Sun, May 27, 2012 at 7:07 PM, Richard O'Keefe wrote: > > On 26/05/2012, at 4:16 AM, David Turner wrote: > > > > I don't. I think the trouble is that classes don't add value in > exercises of this size. > > This was the key point, I think. > In this example, there wasn't any significant behavio

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Magicloud Magiclouds
Alright, with another box of different version of ghc and things. I finally got the cause. Or may I say as simple as Ozgun said, ghc 7.4.1 defaultly uses optimization. ghc-7.4.1 -O0 works. ghc-7.2.2 also works. Thank you all. On Sun, May 27, 2012 at 7:07 PM, Chris Dornan wrote: > By configuratio

Re: [Haskell-cafe] A functional programming solution for Mr and Mrs Hollingberry

2012-05-27 Thread Richard O'Keefe
On 26/05/2012, at 4:16 AM, David Turner wrote: > > I don't. I think the trouble is that classes don't add value in exercises of > this size. This was the key point, I think. In this example, there wasn't any significant behaviour that could be moved to superclasses. For that matter, whether a

Re: [Haskell-cafe] Building pattern and trying monads

2012-05-27 Thread wren ng thornton
On 5/27/12 8:21 AM, L Corbijn wrote: > 2. My solution with saving/reverting monad-stacks seems quite a > hassle/hack, so is it a good approach or is there something better? One good solution for backtracking is to use logict[1]. I've used it with various state-like monads and it works well (e.g.,

Re: [Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Steffen Schuldenzucker
Hi Chris, On 05/27/2012 10:04 AM, Chris Wong wrote: I just came up with a way of executing multiple folds in a single pass. In short, we can write code like this: average = foldLeft $ (/)<$> sumF<*> lengthF and it will only traverse the input list once. The code is at: https://gist.git

Re: [Haskell-cafe] Building pattern and trying monads

2012-05-27 Thread Stephen Tetley
It's common to use a writer monad possibly stacked with other monads (e.g. a state monad for fresh variable names) for code generation that approximates "macro expansion" - i.e. one call in Haskell maps to one-or-more lines of code in the output language, no global transformations are permitted. I

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Ozgun Ataman
Maybe try with "ghc --make -O0". Afaik, ghci and runhaskell don't do any optimization, which could be the difference. On May 27, 2012, at 5:12 PM, Magicloud Magiclouds wrote: > Hi, > Sorry for the delayed reply. I am using ghc 7.4.1 and LDAP 0.6.6. > When you said "configuration of the Op

[Haskell-cafe] Building pattern and trying monads

2012-05-27 Thread L Corbijn
Hello cafe, I'm working on a project where the main goal of the program is building some complex output (e.g. a Haskell function, module, etc.). In this process there is almost always some partially finished product on which to work. Currently I'm modelling this with a wrapper around StateT contai

Re: [Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Stephen Tetley
There are a few blog posts by Conal Elliott and Max Rabkin (I think) reifying folds as a data type to get more "composition" and thus fold different functions at the same time. Search for "beautiful folding" with the above authors names. Personally I didn't find the examples significantly more "be

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Chris Dornan
By configuration of the OpenLDAP client library I mean mostly so that SSL connections will work, but this is all system-level configuration. That GHC establishes connections in interactive mode for you indicates that the problem is not with the LDAP systems, but that something peculiar is going

Re: [Haskell-cafe] Record syntax, reopening a can of worms.

2012-05-27 Thread Yves Parès
I enclosed a source file that shows the use of a GADT in that case. 2012/5/27 > Somehow I don't understand you. > Could you please fill out your example into a working bit of code? > > Thank you, > > Timothy > > > -- Původní zpráva -- > Od: Yves Parès > > Datum: 27. 5. 2012 > Př

Re: [Haskell-cafe] Problem with packet documentation generated by cabal on windows 7

2012-05-27 Thread Paulo Pocinho
Chrome works well. The "file://" portion at the beginning has got to do with windows namespace [1] and browser conventions. On 26 May 2012 02:40, Antoine Latter wrote: > Also 'cabal' doesn't track executables, only libraries. It does update your cabal package binaries, if the package generates o

Re: [Haskell-cafe] Record syntax, reopening a can of worms.

2012-05-27 Thread timothyhobbs
Somehow I don't understand you. Could you please fill out your example into a working bit of code? Thank you, Timothy -- Původní zpráva -- Od: Yves Parès Datum: 27. 5. 2012 Předmět: Re: [Haskell-cafe] Record syntax, reopening a can of worms. " > case myData of >   myA@A{} ->

Re: [Haskell-cafe] Record syntax, reopening a can of worms.

2012-05-27 Thread Yves Parès
> case myData of > myA@A{} -> fooForA's myA > myB@B{} -> fooForB's myB I think this would typecheck if you used GADTs. Actually what you'd want is to use the record syntax with GADTs (there are to add the extra type safety you want), however both are not compatible. data ALike data BLike dat

Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-27 Thread Magicloud Magiclouds
Hi, Sorry for the delayed reply. I am using ghc 7.4.1 and LDAP 0.6.6. When you said "configuration of the OpenLDAP client library", may I have more information? Since ldap-utils and other client (php, perl, etc) do not have any problem. This might be the only clue to me. On Fri, May 25, 2012 a

Re: [Haskell-cafe] A functional programming solution for Mr and Mrs Hollingberry

2012-05-27 Thread Ketil Malde
Andreas Pauley writes: > Do you know of an exercise where classes would add value? Something > fairly small, roughly similar in size to this exercise. AFAICR, the motivating example for OO (in Simula) was simulating an environment where different entities interact - I think the case was queues i

Re: [Haskell-cafe] Record syntax, reopening a can of worms.

2012-05-27 Thread timothyhobbs
Your Maybe example is very contrived.  The place where I ran into this was much less contrived I think. I have an editor for a visual programming language. That looks like this: https://github.com/timthelion/gridhaskell-haskarrow/wiki I'm using a modified version of the Document-View model for

Re: [Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Eugene Kirpichov
A lot of people have done this :) eg from me: google up a fairly recent thread from me about processing streams and perhaps the keyword "timeplot" (writing from a dying phone, can't do myself) 27.05.2012, в 12:04, Chris Wong написал(а): > Hello all > > I just came up with a way of executing

[Haskell-cafe] Finding the average in constant space

2012-05-27 Thread Chris Wong
Hello all I just came up with a way of executing multiple folds in a single pass. In short, we can write code like this: average = foldLeft $ (/) <$> sumF <*> lengthF and it will only traverse the input list once. The code is at: https://gist.github.com/2802644 My question is: has anyone do