[Haskell-cafe] A handy little consequence of the Cont monad

2008-01-31 Thread Cale Gibbard
Hello, Today on #haskell, resiak was asking about a clean way to write the function which allocates an array of CStrings using withCString and withArray0 to produce a new with* style function. I came up with the following: nest :: [(r -> a) -> a] -> ([r] -> a) -> a nest xs = runCont (sequence (ma

Re: Fwd: Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Isaac Dupree
You could solve it this way: data PairL a b = PairL a !b where (a,b,c) is syntactic sugar for PairL a (PairL b (PairL c ())) There are still potential efficiency issues, although this could be worked out in the compiler; right now it's a single operation to get from a tuple to any member, b

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Isaac Dupree
Wolfgang Jeltsch wrote: Well, the representation (D1,D2,D9) might be considered more readable. It has the disadvantage of a fixed maximum size for the numbers. Which takes me to a point I had already considered some time ago: Wouldn’t it be good if we had just a type data Pair val1 val2

Re: [Haskell-cafe] derive Pretty?

2008-01-31 Thread Stefan O'Rear
On Thu, Jan 31, 2008 at 03:00:15PM -0800, Greg Fitzgerald wrote: > Is it possible to automatically derive instances of > Pretty? > If no, what do most do when it comes to pretty-printing large data types? I

Re: [Haskell-cafe] Linear algebra

2008-01-31 Thread Denis Bueno
On Thu, Jan 31, 2008 at 7:11 PM, Jon Harrop <[EMAIL PROTECTED]> wrote: > > Has anyone written anything on the use of FP (e.g. point free style) in > linear > algebra problems? I'm not sure how relevant this is to you, but John Backus wrote foundationally on it and related topics. http://www.st

Fwd: Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Wolfgang Jeltsch
Hello Ryan, I hope, it’s okay to forward your message to the list: > Date: Freitag, 1. Februar 2008 01:41 > From: "Ryan Ingram" <[EMAIL PROTECTED]> > To: "Wolfgang Jeltsch" <[EMAIL PROTECTED]> This representation is not exactly the same when you include _|_. For example: > data None -- only _|_

[Haskell-cafe] Linear algebra

2008-01-31 Thread Jon Harrop
Has anyone written anything on the use of FP (e.g. point free style) in linear algebra problems? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://ww

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-31 Thread Dan Weston
> Hmmm, not sure what you asking for. If you have a monad instance Set a > that has Eq a attached, this > already would do what you want, no? An example would help me to > understand... Sorry, I meant uppercase (and got the constraint wrong anyway). I meant that Ord a => Set a was a monad (lower

[Haskell-cafe] derive Pretty?

2008-01-31 Thread Greg Fitzgerald
Is it possible to automatically derive instances of Pretty? If no, what do most do when it comes to pretty-printing large data types? Thanks, Greg ___ Haskell-Caf

Re: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Wolfgang Jeltsch
Am Donnerstag, 31. Januar 2008 15:15 schrieben Sie: > […] > I think we should base our implementation on Oleg's (for which we need > his permission). Do you know whether Oleg has released his code under an open source license? If he had, we wouldn’t need his permission. I’m not sure whether we

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Wolfgang Jeltsch
Am Donnerstag, 31. Januar 2008 18:30 schrieb Dominic Steinitz: > Look at > > http://sneezy.cs.nott.ac.uk/fun/feb-07/jeremy-slides.pdf This is essentially what I had in mind. While Oleg’s implementation needs a “thrusted core”, the GADT solution doesn’t. It would be interesting to combine GADTs

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-31 Thread Gabor Greif
Am 31.01.2008 um 18:13 schrieb Dan Weston: Even though you cannot "dive into this matter now", maybe when you get time you can update your blog with an explicit embedding of Haskell monads and arrows in your Thrist construction. Concrete examples will help me (and probably others) more quic

[Haskell-cafe] Re: announcing darcs 2.0.0pre3

2008-01-31 Thread John Goerzen
On 2008-01-31, David Roundy <[EMAIL PROTECTED]> wrote: >> way to pull down everything that could possibly be needed? But from >> the way the wiki page is sounded, it doesn't sound that way. > > Running "darcs check", "darcs changes -s" or "darcs changes foobar" for > instance would ensure that you

[Haskell-cafe] Re: [darcs-devel] announcing darcs 2.0.0pre3

2008-01-31 Thread Don Stewart
droundy: > On Thu, Jan 31, 2008 at 11:51:10AM -0700, zooko wrote: > > I would suggest that strict get should be the default and lazy is a > > command-line option. > > Okay. I'm convinced, and am pushing a patch to do this. Great! ___ Haskell-Cafe mai

Re: [Haskell-cafe] fast graph algorithms without object identities

2008-01-31 Thread Jan-Willem Maessen
On Jan 31, 2008, at 5:39 AM, Henning Thielemann wrote: It seems that algorithms on graphs can be implemented particularly efficient in low-level languages with pointers and in-place updates. E.g. topological sort needs only linear time, provided that dereferencing pointers requires constant

Re: [Haskell-cafe] RE: [Haskell] Announce: Yi 0.3

2008-01-31 Thread gwern0
On 2008.01.31 16:27:05 -, "Bayley, Alistair" <[EMAIL PROTECTED]> scribbled 0.7K characters: > > From: Thomas Schilling [mailto:[EMAIL PROTECTED] > > > > > > So Yi works on Windows? hs-plugins was broken for Windows > > for a while, > > > so I'm wondering if this has been fixed too. Does Yi use

[Haskell-cafe] Re: [darcs-devel] announcing darcs 2.0.0pre3

2008-01-31 Thread David Roundy
On Thu, Jan 31, 2008 at 11:51:10AM -0700, zooko wrote: > I would suggest that strict get should be the default and lazy is a > command-line option. Okay. I'm convinced, and am pushing a patch to do this. -- David Roundy Department of Physics Oregon State University

[Haskell-cafe] Re: [darcs-devel] announcing darcs 2.0.0pre3

2008-01-31 Thread zooko
On Jan 31, 2008, at 9:15 AM, David Roundy wrote: On Thu, Jan 31, 2008 at 09:47:06AM -0600, John Goerzen wrote: I have one concern though, and it's a big one. On your DarcsTwo page, it says: Darcs get is now much faster, and always operates in a "lazy" fashion, meaning that patches are

[Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Bjorn Buckwalter
Alfonso Acosta gmail.com> writes: > 2) An implementation of type-level Naturals would really help. What > has already been done? I see you have received many suggestions already and personally I don't think you can go wrong with Oleg (et al)'s implementations. For a decimal representation you pr

Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-01-31 Thread Magnus Therning
On 1/31/08, Peter Verswyvelen <[EMAIL PROTECTED]> wrote: > > >winds up having a write cache, which is mutable in practice. The > >interesting thing is that the block's location is the cryptographic > >hash of its contents, which leads to all sorts of neat properties (as > >well as requiring immuta

Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-01-31 Thread Lanny Ripple
Depending on which hash you use you can get upwards of "document hask keys won't collide before the heat-death of the universe". There is of course a lot more to it than that. Google around about hashing, cryptography, and cryptographic hash functions. There are many good websites that will g

Re: Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-01-31 Thread Bulat Ziganshin
Hello Peter, Thursday, January 31, 2008, 8:01:36 PM, you wrote: > files with different content generating the same hash)... My > intuition told me that the odds of two cryptographic hashes (on > meaningful content) colliding was much less than the earth being > destroyed by an asteroid... But thi

Re: [Haskell-cafe] Poor libraries documentation

2008-01-31 Thread Derek Elkins
On Thu, 2008-01-31 at 09:46 -0500, Anton van Straaten wrote: > Derek Elkins wrote: > > On Wed, 2008-01-30 at 22:19 -0500, Anton van Straaten wrote: > ... > >> We discover a function called, say, "cos", probably by guessing it's > >> name, run a very small number of simple tests on it, see the answ

Re: Re[2]: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Alfonso Acosta
On Jan 31, 2008 5:47 PM, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > one more: > darcs get --partial --tag '0.1' http://www.eecs.tufts.edu/~rdocki01/typenats/ Thanks for the link, I had already checked this library, but using a binary representation has the same problem as using peano numbers, er

[Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Dominic Steinitz
Look at http://sneezy.cs.nott.ac.uk/fun/feb-07/jeremy-slides.pdf and http://article.gmane.org/gmane.comp.lang.haskell.cafe/27062 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-31 Thread Dan Weston
Even though you cannot "dive into this matter now", maybe when you get time you can update your blog with an explicit embedding of Haskell monads and arrows in your Thrist construction. Concrete examples will help me (and probably others) more quickly see the novelty, increased generality, and

Re[2]: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Bulat Ziganshin
Hello Henning, Thursday, January 31, 2008, 5:49:23 PM, you wrote: > I remember that type-level arithmetic is already implemented somewhere, > certainly more than once, but certainly seldom in a nicely packaged form. one more: darcs get --partial --tag '0.1' http://www.eecs.tufts.edu/~rdocki01/ty

Re: [Haskell-cafe] RE: [Haskell] Announce: Yi 0.3

2008-01-31 Thread Peter Verswyvelen
Is YI also an IDE for creating Haskell code? I guess it's not, it's "just" a text editor right? I mean, if it talks to GHC directly, it could neatly take over some tricks used in Visual Haskell (on the fly type inference, good completion, etc), only much much easier (without the COM layer, dire

Cryptographic hash uniquness (was [Haskell-cafe] Simple network client)

2008-01-31 Thread Peter Verswyvelen
>winds up having a write cache, which is mutable in practice. The >interesting thing is that the block's location is the cryptographic >hash of its contents, which leads to all sorts of neat properties (as >well as requiring immutability). That's interesting. When I developed a version control s

Re: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Alfonso Acosta
> I remember that type-level arithmetic is already implemented somewhere, > certainly more than once, but certainly seldom in a nicely packaged form. > > erm, here > http://www.haskell.org/haskellwiki/Type_arithmetic Yep, there seem to be a few implementations around (decimal, binary, peano) but

RE: [Haskell-cafe] RE: [Haskell] Announce: Yi 0.3

2008-01-31 Thread Bayley, Alistair
> From: Thomas Schilling [mailto:[EMAIL PROTECTED] > > > > So Yi works on Windows? hs-plugins was broken for Windows > for a while, > > so I'm wondering if this has been fixed too. Does Yi use > hs-plugins, or > > does it go straight down to ghc? (looking at the yi.cabal > file seems to > > in

[Haskell-cafe] Re: [darcs-devel] announcing darcs 2.0.0pre3

2008-01-31 Thread David Roundy
On Thu, Jan 31, 2008 at 09:47:06AM -0600, John Goerzen wrote: > On 2008-01-22, David Roundy <[EMAIL PROTECTED]> wrote: > > We are happy to announce the third prerelease version of darcs 2! Darcs 2 > > I'm very happy to see this, and will be trying it out today! Great! I do recommend that you try t

[Haskell-cafe] Re: announcing darcs 2.0.0pre3

2008-01-31 Thread John Goerzen
On 2008-01-22, David Roundy <[EMAIL PROTECTED]> wrote: > We are happy to announce the third prerelease version of darcs 2! Darcs 2 David, I'm very happy to see this, and will be trying it out today! I have one concern though, and it's a big one. On your DarcsTwo page, it says: Darcs get is n

Re: [Haskell-cafe] RE: [Haskell] Announce: Yi 0.3

2008-01-31 Thread Thomas Schilling
On Thu, 2008-01-31 at 15:23 +, Bayley, Alistair wrote: > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of > > Jean-Philippe Bernardy > > > > * homepage: http://haskell.org/haskellwiki/Yi > > Took a quick look around and saw this: > * GTK frontend works in Win32 > >

Re: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Henning Thielemann
On Thu, 31 Jan 2008, Alfonso Acosta wrote: > On Jan 31, 2008 3:03 PM, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: > > Hello Fons, > > > > interestingly, it occured to me yesterday that the graphics part of > > Grapefruit > > would benefit from fixed sized vectors. I think we should implement so

[Haskell-cafe] Re: Simple network client

2008-01-31 Thread David B . Wildgoose
Adam Langley imperialviolet.org> writes: > > On Jan 31, 2008 5:07 AM, Gary Bickford fxt.com> wrote: > > Wasn't there a Linux file system (possibly a FUSE user-space one) that > > worked on writable CDs? IIRC it worked by marking the previous copy of > > the file as erased, and writing a new co

Re: [Haskell-cafe] Poor libraries documentation

2008-01-31 Thread Anton van Straaten
Henning Thielemann wrote: On Thu, 31 Jan 2008, Anton van Straaten wrote: Derek Elkins wrote: Arguably, this -is- more defensible on a safety/correctness grounds than reading the documentation. Documentation can be out of date or wrong or right but the implementation is wrong. So it comes do

Re: [Haskell-cafe] Simple network client

2008-01-31 Thread Jonathan Cast
On 31 Jan 2008, at 1:23 AM, Reinier Lamers wrote: Bayley, Alistair wrote: More than one person has posted previously about the flaws and traps of lazy IO. A common position seems to be "don't do lazy IO". Still, when I was browsing the Haskell' wiki a few days ago, I couldn't find any prop

[Haskell-cafe] RE: [Haskell] Announce: Yi 0.3

2008-01-31 Thread Bayley, Alistair
> From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Jean-Philippe Bernardy > > * homepage: http://haskell.org/haskellwiki/Yi Took a quick look around and saw this: * GTK frontend works in Win32 So Yi works on Windows? hs-plugins was broken for Windows for a while, so I'm w

Re: [Haskell-cafe] Poor libraries documentation

2008-01-31 Thread Henning Thielemann
On Thu, 31 Jan 2008, Anton van Straaten wrote: > Derek Elkins wrote: > > > Arguably, this > > -is- more defensible on a safety/correctness grounds than reading the > > documentation. Documentation can be out of date or wrong or right but > > the implementation is wrong. So it comes down to a ma

Re: [Haskell-cafe] Mission: To take args from an n-tuple ... generally

2008-01-31 Thread Martin Hofmann
> > I wondered, why not take an n-tuple of arguments s.t. > > > >multApply' :: (a1->a2->...->an->o) -> (a1,(a2,(...(an,o)...))) -> > o > > > I'm not sure what you're trying to do here. Why is there an o in the > argument? Also, do you really mean the number of arguments expected to > match th

[Haskell-cafe] CFP - PLMMS 2008

2008-01-31 Thread Jacques Carette
FIRST CALL FOR PAPERS Second Workshop on Programming Languages for Mechanized Mathematics (PLMMS 2008) http://events.cs.bham.ac.uk/cicm08/workshops/plmms/ As part of CICM / Ca

Re: [Haskell-cafe] Simple network client

2008-01-31 Thread Adam Langley
On Jan 31, 2008 5:07 AM, Gary Bickford <[EMAIL PROTECTED]> wrote: > Wasn't there a Linux file system (possibly a FUSE user-space one) that > worked on writable CDs? IIRC it worked by marking the previous copy of > the file as erased, and writing a new copy. Probably you're thinking of layering a

Re: [Haskell-cafe] Mission: To take args from an n-tuple ... generally

2008-01-31 Thread Jeff Polakow
Hello, > I wondered, why not take an n-tuple of arguments s.t. > >multApply' :: (a1->a2->...->an->o) -> (a1,(a2,(...(an,o)...))) -> o > I'm not sure what you're trying to do here. Why is there an o in the argument? Also, do you really mean the number of arguments expected to match the numb

Re: [Haskell-cafe] Poor libraries documentation

2008-01-31 Thread Anton van Straaten
Derek Elkins wrote: On Wed, 2008-01-30 at 22:19 -0500, Anton van Straaten wrote: ... We discover a function called, say, "cos", probably by guessing it's name, run a very small number of simple tests on it, see the answers we expect, and decide that it's the function we want. Does anyone want

Re: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Alfonso Acosta
On Jan 31, 2008 3:03 PM, Wolfgang Jeltsch <[EMAIL PROTECTED]> wrote: > Hello Fons, > > interestingly, it occured to me yesterday that the graphics part of Grapefruit > would benefit from fixed sized vectors. I think we should implement some > small Cabal package which just provides this and upload

Re: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Wolfgang Jeltsch
Am Donnerstag, 31. Januar 2008 12:02 schrieb Alfonso Acosta: > Hi, > > The EDSL implementation (system design) I'm working on would really > benefit from an implementation of fixed-sized vectors. > > I thought this would be a generally desired ADT but it turned out I > wasn't able to find an implem

[Haskell-cafe] Mission: To take args from an n-tuple ... generally

2008-01-31 Thread Martin Hofmann
Dear Community. I have recently read Joel Koerwer's posting how to evaluate a function of type (a->a->...->a->a), taking the arguments from a list (http://haskell.org/pipermail/haskell-cafe/2006-October/018658.html). Therefore, he introduced a function multApply: multApply :: (a->a->...->

Re: [Haskell-cafe] Simple network client

2008-01-31 Thread Gary Bickford
Wasn't there a Linux file system (possibly a FUSE user-space one) that worked on writable CDs? IIRC it worked by marking the previous copy of the file as erased, and writing a new copy. On Wed, 2008-01-30 at 23:05 -0500, [EMAIL PROTECTED] wrote: > > PS: I would love to see an immutable filesystem

Re: [Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Henning Thielemann
On Thu, 31 Jan 2008, Alfonso Acosta wrote: > The EDSL implementation (system design) I'm working on would really > benefit from an implementation of fixed-sized vectors. > > I thought this would be a generally desired ADT but it turned out I > wasn't able to find an implementation. > > I was thin

[Haskell-cafe] Implementing fixed-sized vectors (using datatype algebra?)

2008-01-31 Thread Alfonso Acosta
Hi, The EDSL implementation (system design) I'm working on would really benefit from an implementation of fixed-sized vectors. I thought this would be a generally desired ADT but it turned out I wasn't able to find an implementation. I was thinking about using datatype algebra plus GADTs to im

[Haskell-cafe] fast graph algorithms without object identities

2008-01-31 Thread Henning Thielemann
It seems that algorithms on graphs can be implemented particularly efficient in low-level languages with pointers and in-place updates. E.g. topological sort needs only linear time, provided that dereferencing pointers requires constant time. I could simulate pointer dereferencings and pointer upd

[Haskell-cafe] Re: [Haskell] Why functional programming matters

2008-01-31 Thread apfelmus
Stephan Friedrichs wrote: I just uploaded a generalised heap (min-, max- and custom-heaps) implementation: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/heap-0.1 Feedback would be appreciated :) Feedback: I think the HeapPolicy thing is too non-standard. The canonical way would

Re: [Haskell-cafe] Simple network client

2008-01-31 Thread Reinier Lamers
Bayley, Alistair wrote: More than one person has posted previously about the flaws and traps of lazy IO. A common position seems to be "don't do lazy IO". Still, when I was browsing the Haskell' wiki a few days ago, I couldn't find any proposal to remove lazy I/O or move it into some special

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-31 Thread Gabor Greif
Am 31.01.2008 um 01:23 schrieb [EMAIL PROTECTED]: 3. I believe the documentation stating that Haskell arrows are a generalization of Haskell monads, but arrows are a categorical thing too and in that context bear a much more distant relationship to monads. Does a Haskell arrow have Hask a

[Haskell-cafe] Re: Relevance and applicability of category theory

2008-01-31 Thread apfelmus
aaltman wrote: My issues: 1. Are Haskell monads useful in a truly categorical sense? 2. Is Haskell's functor class misnamed? 3. Haskell arrows and Haskell monads have a misleading relationship 1.+2. The stumbling block is probably that Hask has exponentials and polymorphism. Hence, all morphis

Re: [Haskell-cafe] Poor libraries documentation

2008-01-31 Thread Lutz Donnerhacke
* Jonathan Cast wrote: > On 30 Jan 2008, at 7:19 PM, Anton van Straaten wrote: > > quickCheck $ x -> cos (x + 2*pi) == cos x > Falsifiable, after 2 tests: > -1.0 > Test.QuickCheck.quickCheck $ \x -> abs (cos x - cos (x + 2*pi)) < 0.1 OK, passed 100 tests. _