Re[2]: [Haskell-cafe] Haskell arrays

2009-12-17 Thread Bulat Ziganshin
Hello michael, Thursday, December 17, 2009, 6:54:24 AM, you wrote: what is you see here is called association list. *function* array takes an index range and assoclist and returns an array. notice that data constructors are started with capital letter, f.e. Array

Re: [Haskell-cafe] Haskell and memoization

2009-12-17 Thread Ozgur Akgun
Maybe not related, but does the following prove next is called once and only once. import qualified Data.ByteString as BS import qualified Data.ByteString.Char8 as BSC next = do nextcache - BS.readFile next.cache let nextint = readInt (BSC.unpack nextcache)

Re: [Haskell-cafe] Haskell and memoization

2009-12-17 Thread Ozgur Akgun
Sorry for the last mail, I now tried it and it returns the next value every time I call it. I was using an unsafeperformIO trick somewhere, and that fas the one resulting in the previously described behaviour. You can just ignore the previous mail. 2009/12/17 Ozgur Akgun ozgurak...@gmail.com

Re: [Haskell-cafe] ANN: Hemkay, the 100% Haskell MOD player

2009-12-17 Thread Patai Gergely
Hello again, Your message has motivated me to publish my own PortAudio binding, which provides a simpler, more efficient callback-based interface: http://github.com/mietek/portaudio I tried this, and after rewriting the code a bit, I managed to decrease CPU load by 70-80%, which is not bad for

Re: [Haskell-cafe] Design question

2009-12-17 Thread hask...@kudling.de
Hi all, thanks for your ideas so far. I think you might be looking for too much sugar.  I don't know much about your problem, but I would use approximately your approach and be straightforward: To bother you with some details: i am building a model for an SVG document.

[Haskell-cafe] Re: parallel and distributed haskell?

2009-12-17 Thread Simon Marlow
On 16/12/2009 19:21, Scott A. Waterman wrote: It looks like there was a recent hackathon focusing on implementing distributed haskell. http://hackage.haskell.org/trac/ghc/wiki/HackPar I feel there is quite a bit of latent interest in the subject here, but relatively little active development

Re: [Haskell-cafe] Design question

2009-12-17 Thread minh thu
2009/12/17 hask...@kudling.de hask...@kudling.de: Hi all, thanks for your ideas so far. I think you might be looking for too much sugar. I don't know much about your problem, but I would use approximately your approach and be straightforward: To bother you with some details: i am

[Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Stephen Lavelle
Given class MyClass k where type AssociatedType k :: * Is there a way of requiring AssociatedType be of class Eq, say? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Design question

2009-12-17 Thread Stephen Tetley
Ohhh... SVG is a truly horrible format though, that almost completely disguises the fact you are working with geometry. Being rude about the designers, its as if they realized half way through the job that putting a function-free PostScript into angle brackets was far too verbose, so they added

Re: [Haskell-cafe] Design question

2009-12-17 Thread hask...@kudling.de
I'd strongly recommend you simply choose a set of geometric objects paths, polygons, whatever... and work with those, only considering SVG as a final rendering step when you could probably just generate I do, cheers. The SVG model is just an intermediate representation for the SVG

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Miguel Mitrofanov
{-# LANGUAGE GADTs, TypeFamilies #-} module Assoc where data EqD k where EqD :: Eq k = EqD k class MyClass k where data AssociatedType k :: * evidence :: AssociatedType k - EqD (AssociatedType k) eq :: MyClass k = AssociatedType k - AssociatedType k - Bool -- eq k1 k2 = k1 == k2 --

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Miguel Mitrofanov
Along the same lines: {-# LANGUAGE GADTs, TypeFamilies #-} module Assoc where data EqD k where EqD :: Eq k = EqD k class MyClass k where type AssociatedType k :: * evidence :: k - EqD (AssociatedType k) instance MyClass () where type AssociatedType () = Integer evidence _ = EqD eq

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Roman Leshchinskiy
On 18/12/2009, at 00:37, Stephen Lavelle wrote: Given class MyClass k where type AssociatedType k :: * Is there a way of requiring AssociatedType be of class Eq, say? This works with -XFlexibleContexts: class Eq (AssociatedType k) = MyClass k where type AssociatedType k :: * Roman

Re: [Haskell-cafe] Double free-ing (was: Reading from a process)

2009-12-17 Thread Mitar
Hi! On Thu, Dec 17, 2009 at 5:28 AM, Jason Dusek jason.du...@gmail.com wrote:  It seems like the message delimiter to me because you keep  buffering till you receive it. Hm, true. I have changed code to this: getLastMyData :: MySate (Maybe MyData) getLastMyData = do p - gets process case

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Tom Schrijvers
class MyClass k where type AssociatedType k :: * Is there a way of requiring AssociatedType be of class Eq, say? Have you tried: {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} class Eq (AssociatedType k) = MyClass k where type AssociatedType k :: * ? Cheers, Tom --

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Conor McBride
Hi all On 17 Dec 2009, at 14:22, Tom Schrijvers wrote: class MyClass k where type AssociatedType k :: * Is there a way of requiring AssociatedType be of class Eq, say? Have you tried: {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} class Eq (AssociatedType k) = MyClass k

[Haskell-cafe] lhs2tex, Haskell Platform and cygwin

2009-12-17 Thread Jacques Carette
I just downloaded a fresh copy of Haskell Platform, and successfully got cabal to update itself. I installed smallcheck-0.4 successfully too. But then I tried to install lhs2tex, which 'worked' until the point of saying: Linking dist\build\lhs2TeX\lhs2TeX.exe ... Installing executable(s) in

RE: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Simon Peyton-Jones
Hmm. If you have class (Diff (D f)) = Diff f where then if I have f :: Diff f = ... f = e then the constraints available for discharging constraints arising from e are Diff f Diff (D f) Diff (D (D f)) Diff (D (D (D f))) ... That's a lot

[Haskell-cafe] REMINDER: Next BostonHaskell meeting TONIGHT at MIT

2009-12-17 Thread Ravi Nanavati
The full details of the event are here: http://groups.google.com/group/bostonhaskell/t/792df9787155b5cc I'm just sending out this reminder to make sure more people hear about the event. If you're planning to come please respond to our attendance poll at: http://doodle.com/p2zcnca6k39iptb4 This

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Jacques Carette
Which is 'right' in a way, since in the language Conor defined, all definable terms are infinitely differentiable, and that can be inferred from the given rules. That, in practice, you only need a finite number of them in any given computation is derivable from the instances, but is not a

Re: [Haskell-cafe] lhs2tex, Haskell Platform and cygwin

2009-12-17 Thread Stephen Tetley
Hi Jacques Does it install properly by the runhaskell Setup.hs configure / build / install? I re-installed it this way a couple of weeks ago and it never mentioned mktexlsr. From a runhaskell Setup.hs ... install it did have a couple of problems which don't relate to your problem but seem worth

[Haskell-cafe] Haskell Platform mailing list?

2009-12-17 Thread Gregory Collins
Hi all, I'm getting the following error trying to post to the haskell-platform list: haskell-platf...@projects.haskell.org Delay reason: SMTP error from remote mail server after end of data: host community.haskell.org [72.249.126.23]: 451 Temporary local problem - please try later G

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Conor McBride
On 17 Dec 2009, at 15:31, Simon Peyton-Jones wrote: Hmm. If you have class (Diff (D f)) = Diff f where then if I have f :: Diff f = ... f = e then the constraints available for discharging constraints arising from e are Diff f Diff (D f) Diff (D

Re: [Haskell-cafe] lhs2tex, Haskell Platform and cygwin

2009-12-17 Thread Jacques Carette
Stephen Tetley wrote: Hi Jacques Does it install properly by the runhaskell Setup.hs configure / build / install? I re-installed it this way a couple of weeks ago and it never mentioned mktexlsr. No, it doesn't. I first run into issues with exceptions-related issues (as you did), which I

RE: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Simon Peyton-Jones
| Hmm. If you have |class (Diff (D f)) = Diff f where | | then if I have | f :: Diff f = ... | f = e | then the constraints available for discharging constraints arising | from e are | Diff f | Diff (D f) | Diff (D (D f)) | Diff (D (D (D f))) | ... | |

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Stephen Lavelle
Ah yes, this is very very very helpful. Thanks : ) Miguel's example is not quite as idiomatic, but...for some reason I find it beguiling nonetheless. On Thu, Dec 17, 2009 at 2:36 PM, Roman Leshchinskiy r...@cse.unsw.edu.au wrote: On 18/12/2009, at 00:37, Stephen Lavelle wrote: Given class

Re: [Haskell-cafe] Cabal

2009-12-17 Thread Nils Anders Danielsson
On 2009-11-09 12:39, Duncan Coutts wrote: You'll be glad to know this is addressed in Cabal-1.8, though not in a fully automatic way. The problem with sharing automatically is knowing when it is safe to do so and when it is not. Each component that shares a source file can use different compiler

Re: [Haskell-cafe] lhs2tex, Haskell Platform and cygwin

2009-12-17 Thread Stephen Tetley
2009/12/17 Jacques Carette care...@mcmaster.ca: mktexlsr is a /bin/sh script, so it's quite natural that an Exec on that would fail.  So I'm still stuck. Ah ha - yes running mktexlsr is an optional step on page 5 of the lhs2TeX manual necessary to get the poly style. I tried a couple of hacks

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Martin Sulzmann
The statements class Cl [a] = Cl a and instance Cl a = Cl [a] (I omit the type family constructor in the head for simplicyt) state the same (logical) property: For each Cl t there must exist Cl [t]. Their operational meaning is different under the dictionary-passing translation [1]. The

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Dan Weston
I think the denotational meanings are different. The instance also implies: For each Cl t there must exist a Cl u where u does not unify with [v] for some v. In other words, there must be a ground instance. For the class declaration, the existence of a ground instance can be inferred only by

Re: [Haskell-cafe] ANN: Hemkay, the 100% Haskell MOD player

2009-12-17 Thread Henning Thielemann
On Mon, 14 Dec 2009, Patai Gergely wrote: Hello all, I just uploaded the fruit of a little side project. Hemkay [1] is an oldschool module music [2] player that performs all the hard work in Haskell. Cool. The most complicated I tried was to import OctaMED printout to Haskore:

Re: [Haskell-cafe] Restrictions on associated types for classes

2009-12-17 Thread Dan Weston
Oops, reverse that. The *instance* declaration allows for infinite types, the *class* declaration does not. Dan Weston wrote: I think the denotational meanings are different. The instance also implies: For each Cl t there must exist a Cl u where u does not unify with [v] for some v. In

Re: [Haskell-cafe] lhs2tex, Haskell Platform and cygwin

2009-12-17 Thread Jacques Carette
Some success now. Reverting to building by hand, if I 1. edit config.ml to put quotes around the name of the GHC executable (since it contains spaces AND () ), 2. edit Makefile to add -package base-3.0.3.1 on to the --make line, things proceed through the build and install stage properly.

Re: [Haskell-cafe] ANN: Hemkay, the 100% Haskell MOD player

2009-12-17 Thread Patai Gergely
The most complicated I tried was to import OctaMED printout to Haskore: http://darcs.haskell.org/haskore/src/Haskore/Interface/MED/Text.hs http://hackage.haskell.org/packages/archive/haskore/0.1/doc/html/Haskore-Interface-MED-Text.html Oh, I'll have to try that too! I have a

Re: [Haskell-cafe] Double free-ing (was: Reading from a process)

2009-12-17 Thread Jason Dusek
You shouldn't have to use `malloc` and `free` to accumulate input. Just append to a list or a ByteString, which is to say, add a byte to a ByteString to get a new ByteString. Yes, really. Maybe there is something I am missing here; but I can't see any reason to adopt this unnatural (for

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-17 Thread Richard O'Keefe
One obvious rule is that lower_upperupper can be mapped to lowerupperupper and vice versa, but that upper_upper must be left alone. As for ok_URL, this is a good example of why mixing styles isn't so good. To comply with baStudlyCaps style, it should have been okURL in

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-17 Thread Richard O'Keefe
On Dec 17, 2009, at 4:45 AM, Ben Millwood wrote: By the way, I like camelCase because I think that in most cases you *don't* want to break identifiers up into their component words My experience has been that in order to make sense of someone else's code you *HAVE* to break identifiers into

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-17 Thread Luke Palmer
On Thu, Dec 17, 2009 at 8:39 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On Dec 17, 2009, at 4:45 AM, Ben Millwood wrote: By the way, I like camelCase because I think that in most cases you *don't* want to break identifiers up into their component words My experience has been that in

Re: [Haskell-cafe] Double free-ing (was: Reading from a process)

2009-12-17 Thread Mitar
Hi! On Fri, Dec 18, 2009 at 1:53 AM, Jason Dusek jason.du...@gmail.com wrote:  You shouldn't have to use `malloc` and `free` to accumulate  input. Just append to a list or a ByteString, which is to say,  add a byte to a ByteString to get a new ByteString. Yes, really. Oh, I did not know that

[Haskell-cafe] naming naming conventions (was: Re: Allowing hyphens in identifiers)

2009-12-17 Thread wren ng thornton
Richard O'Keefe wrote: (Why do people call baStudly syle camel? Is there somewhere in the world a species of camel with three or four humps, like XmlNodeSansChildren?) camelCase differs from StudlyCaps in the case of the first character (that is, XmlNodeSansChildren is *not* camelCase). The

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-17 Thread Richard O'Keefe
On Dec 18, 2009, at 5:00 PM, Luke Palmer wrote: On Thu, Dec 17, 2009 at 8:39 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On Dec 17, 2009, at 4:45 AM, Ben Millwood wrote: By the way, I like camelCase because I think that in most cases you *don't* want to break identifiers up into their

Re: [Haskell-cafe] naming naming conventions (was: Re: Allowing hyphens in identifiers)

2009-12-17 Thread Richard O'Keefe
On Dec 18, 2009, at 6:04 PM, wren ng thornton wrote: Richard O'Keefe wrote: (Why do people call baStudly syle camel? Is there somewhere in the world a species of camel with three or four humps, like XmlNodeSansChildren?) camelCase differs from StudlyCaps in the case of the first character

[Haskell-cafe] Re: openFd under -threaded gets interrupted

2009-12-17 Thread Mitar
Hi! On Wed, Dec 16, 2009 at 3:18 PM, Mitar mmi...@gmail.com wrote: fd - openFd device ReadWrite Nothing OpenFileFlags { append = False, noctty = True, exclusive = False, nonBlock = True, trunc = False } OK. After some testing I have discovered that the problem is only with /dev/rfcomm0 as a

Re: [Haskell-cafe] Re: Allowing hyphens in identifiers

2009-12-17 Thread Luke Palmer
On Thu, Dec 17, 2009 at 10:39 PM, Richard O'Keefe o...@cs.otago.ac.nz wrote: On Dec 18, 2009, at 5:00 PM, Luke Palmer wrote:  My preferred way to increase the readability of code is to keep names short and *limited in scope*. That's good.  Haskell code is chock full of one and two letter

Re: [Haskell-cafe] Double free-ing (was: Reading from a process)

2009-12-17 Thread Jason Dusek
Concatenating two `ByteString`s is O(n)? -- Jason Dusek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Double free-ing

2009-12-17 Thread Ketil Malde
Mitar mmi...@gmail.com writes: I checked ByteString's hGetNonBlocking now and I do see why it is still better to use System.IO's hGetBufNonBlocking. [...] But with hGetNonBlocking I would have to append two different buffers to get a resulting buffer, what is completely unnecessary O(n).