RE: [Haskell-cafe] How to Create Data Type of memory

2009-09-06 Thread Akshay Dave
Hi Luke, Thanks for your prompt response. I'll try to implement the same for my semantics! Cheers! Akshay > Date: Mon, 7 Sep 2009 00:12:14 -0600 > Subject: Re: [Haskell-cafe] How to Create Data Type of memory > From: lrpal...@gmail.com > To: akshay.v.d...@hotmail.com > CC: haskell-cafe@hask

Re: [Haskell-cafe] How to Create Data Type of memory

2009-09-06 Thread Luke Palmer
On Sun, Sep 6, 2009 at 11:45 PM, Akshay Dave wrote: > Hi, >    Thanks for your prompt reply. Actually I am trying to convert the > following transitive semantics to Haskell: > > (Memory maps I to Z) > lookup m i =   ( meaning lookup for I in memory m) > > evB b m = true/(while b do c od;m) -> (c; w

[Haskell-cafe] "Conceptual Mathematics"

2009-09-06 Thread Vasili I. Galchin
Hello, "Conceptual Mathematics" has been advertised as accessible to high school students. I would like to collect where this book is being taught to high school students and how it is taught(heuristics). I am interested in teaching it to students locally but I realize that these students to

RE: [Haskell-cafe] How to Create Data Type of memory

2009-09-06 Thread Akshay Dave
Hi, Thanks for your prompt reply. Actually I am trying to convert the following transitive semantics to Haskell: (Memory maps I to Z) lookup m i = ( meaning lookup for I in memory m)  evB b m = true/(while b do c od;m) -> (c; while b do c od;m) I have written the boolean expression and st

Re: [Haskell-cafe] How to Create Data Type of memory

2009-09-06 Thread Luke Palmer
On Sun, Sep 6, 2009 at 11:22 PM, Akshay Dave wrote: > Hi All, >    I am stuck in converting the transition semantics in Haskell. Please let > me know how to define memory data types in Haskell( like we define pointer > in C). Prompt help would be greatly appreciated. I'm sorry, but I can't underst

[Haskell-cafe] How to Create Data Type of memory

2009-09-06 Thread Akshay Dave
Hi All, I am stuck in converting the transition semantics in Haskell. Please let me know how to define memory data types in Haskell( like we define pointer in C). Prompt help would be greatly appreciated. Sincerely, Akshay _ Ho

[Haskell-cafe] How to Create Data Type of memory

2009-09-06 Thread Akshay Dave
Hi All, I am stuck in converting the transition semantics in Haskell. Please let me know how to define memory data types in Haskell( like we define pointer in C). Prompt help would be greatly appreciated. Sincerely, Akshay _ Ge

Re: [Haskell-cafe] Re: HList and Type signatures / synonyms

2009-09-06 Thread Alexander Dunlap
2009/9/6 Günther Schmidt : > Hi Edward, > > I suppose you're right, I could have made this a little more detailed. > > I keep reading in and processing data in an accumulating way, ie. lets say I > have a DB table (don't take this literally please, just an example), into > in-memory records of type

[Haskell-cafe] Re: HList and Type signatures / synonyms

2009-09-06 Thread Günther Schmidt
Hi Edward, I suppose you're right, I could have made this a little more detailed. I keep reading in and processing data in an accumulating way, ie. lets say I have a DB table (don't take this literally please, just an example), into in-memory records of type data MyRecord = MyRecord {

Re: [Haskell-cafe] HList and Type signatures / synonyms

2009-09-06 Thread Edward Z. Yang
Excerpts from Günther Schmidt's message of Sun Sep 06 19:40:05 -0400 2009: > I keep accumulating values and right now use plain tuples for that. I end > up with a 12 element tuple and things are a bit messy. Hi, you may want to consider using the Writer monad. [1] > I'd like to use extensible R

[Haskell-cafe] HList and Type signatures / synonyms

2009-09-06 Thread Günther Schmidt
Hi, I keep accumulating values and right now use plain tuples for that. I end up with a 12 element tuple and things are a bit messy. I'd like to use extensible Records from HList instead, thing is I'd like to keep putting type signatures in my code. As it turns out that seems to be where

Re: [Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Peter Verswyvelen
Yes of course Haskell records do this, but these updates are not first class. But this kind of fusion seems rather general. I haven't checked if the compiler already does it. On Sun, Sep 6, 2009 at 9:19 PM, Alberto G. Corona wrote: > Use Haskell records: > > defaultWindowDescription= WindowDescr

Re: [Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Alberto G. Corona
Use Haskell records: defaultWindowDescription= WindowDescription {title="", size=(0,0) ..} Many modifications can be fused in a single statement. for example: newWindowDescription= defaultWindowDescription{itle= "Haskell" ; size= (640,480),background= Blue} 2009/9/6 Derek Elkins : > The f

Re: [Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Derek Elkins
The first thing I would do i is verify that the compiler is not already doing this. On Sun, Sep 6, 2009 at 7:50 AM, Peter Verswyvelen wrote: > I've seen a couple of package being announced that provide first class > labels, and other packages already existed for this (Grapefruit > Record, HList, A

[Haskell-cafe] Re: How to customize dyre recompile?

2009-09-06 Thread Andy Stewart
Will Donnelly writes: Hi Will, > Hi Andy, > > I feel that I should offer a disclaimer here: You are misusing Dyre > somewhat by attempting to make it handle whole-program recompilation. > It is designed to recompile a single configuration file, generally > against an installed library form of the

[Haskell-cafe] Re: ForeignFunPtr

2009-09-06 Thread Maurí­cio CA
Isn't freeHaskellFunPtr a required finalization procedure? Maurício the purpose of ForeignPtr is to attach a finalization procedure to the object behind the pointer. for example, you can have close called aimplicitly whenever the garbage collector finds you don't need a file handle any more.

[Haskell-cafe] ANNOUNCE: Palindromes 0.1

2009-09-06 Thread Johan Jeuring
Palindromes == Palindromes is a package for finding palindromes in files. Visit the homepage http://www.jeuring.net/Palindromes/ Features The primary features of Palindromes include: * Linear-time algorithm for finding exact palindrome

Re: [Haskell-cafe] Re: memoization

2009-09-06 Thread John Lato
On Sun, Sep 6, 2009 at 4:30 PM, Daniel Fischer wrote: > Am Sonntag 06 September 2009 13:36:57 schrieb John Lato: >> I just discovered that changing DiffArray to a plain Array improves >> performance of my code by almost a factor of 10.  Bitten by DiffArray >> yet again! > > That's strange. Compiled

[Haskell-cafe] Re: How to customize dyre recompile?

2009-09-06 Thread Will Donnelly
Hi Andy, I feel that I should offer a disclaimer here: You are misusing Dyre somewhat by attempting to make it handle whole-program recompilation. It is designed to recompile a single configuration file, generally against an installed library form of the application. Some of its code, specifically

Re: [Haskell-cafe] Re: memoization

2009-09-06 Thread Daniel Fischer
Am Sonntag 06 September 2009 13:36:57 schrieb John Lato: > I just discovered that changing DiffArray to a plain Array improves > performance of my code by almost a factor of 10. Bitten by DiffArray > yet again! That's strange. Compiled without optimisations, using plain Array instead of DiffArra

Re: [Haskell-cafe] ForeignFunPtr

2009-09-06 Thread mf-hcafe-15c311f0c
the purpose of ForeignPtr is to attach a finalization procedure to the object behind the pointer. for example, you can have close called aimplicitly whenever the garbage collector finds you don't need a file handle any more. function pointers do not need finalization. cheers, matthias On Sat,

[Haskell-cafe] Record update fusion (or how should I call it?)

2009-09-06 Thread Peter Verswyvelen
I've seen a couple of package being announced that provide first class labels, and other packages already existed for this (Grapefruit Record, HList, Accessor, ...) Regarding this, I have a question about the performance of multiple composed field updates. Maybe an example. Suppose I have a large

Re: [Haskell-cafe] Averting QuickCheck Madness

2009-09-06 Thread Yusaku Hashimoto
I think using the runTests hook and the test flag make sense, described at http://www.haskell.org/pipermail/haskell-cafe/2008-September/047223.html. I released some libraries in this way, AFAIK it works well. On Sun, Sep 6, 2009 at 4:57 PM, Christopher Lane Hinson wrote: > > There are some librar

[Haskell-cafe] Re: memoization

2009-09-06 Thread John Lato
I just discovered that changing DiffArray to a plain Array improves performance of my code by almost a factor of 10. Bitten by DiffArray yet again! John -- this is no good, just change DiffArray to Array. > update :: (Char -> [Int]) -> DiffArray Int ModP -> Char -> DiffArray Int ModP > update lo

Re: [Haskell-cafe] Trying to reduce memory costs of String duplicates - Oh my god it works

2009-09-06 Thread Günther Schmidt
Hi Luke, Brian, oh my god it works! I'm just saying it because that's a first! Late last night I had already suspected that laziness might be one of the reasons why the memoization technique showed no effect on memory consumption and after Brian's email that's exactly where I tried again,

[Haskell-cafe] Re: memoization

2009-09-06 Thread John Lato
Hello, I agree that your answer is elegant, but it's not an efficient algorithm in any language. How about this, keeping the rest of your code the same? import Data.Array.Diff import Data.IArray update :: (Char -> [Int]) -> DiffArray Int ModP -> Char -> DiffArray Int ModP update lookup arr c =

[Haskell-cafe] Re: Don't “accidentallyparallelize”

2009-09-06 Thread Gracjan Polak
Dan Doel gmail.com> writes: > On Sunday 06 September 2009 2:18:31 am David Menendez wrote: > > > > It turns out, pseq limits the effectiveness of strictness analysis, > > because it forces the order of evaluation. John Meacham described this > > pretty well last week in the Haskell' list > >

[Haskell-cafe] Averting QuickCheck Madness

2009-09-06 Thread Christopher Lane Hinson
There are some libraries that depend on QuickCheck 2, and others that depend on QuickCheck 1. This can be a problem. AIUI, the Haskell Platform current depends on QC1, but intends to move to QC2 soon. I also know that the cabal mailing list has talked about some kind of private-depends cap

Re: [Haskell-cafe] Re: Don't “accidentallyparallelize”

2009-09-06 Thread Dan Doel
On Sunday 06 September 2009 2:18:31 am David Menendez wrote: > On Sat, Sep 5, 2009 at 7:57 PM, Dan Doel wrote: > > I suppose technically, what foldl' has over foldl is that it is more > > readily subject to optimization. Each recursive call is artificially made > > strict in the accumulator, so it