[Haskell-cafe] Re: Sugar for function application

2010-03-25 Thread Heinrich Apfelmus
Tillmann Rendel wrote: I like this idea, because it would enable non-monadic embedded DSLs to use layout. For example, consider setting properties in wxHaskell: layoutSet myButton $$ text := Ok on action := doSomething You can abuse do notation to achieve that, by wrapping

[Haskell-cafe] Re: breadth first search one-liner?

2010-03-25 Thread Heinrich Apfelmus
Johannes Waldmann wrote: Dear all, there is this neat one-line BFS implementation bfs :: Eq a = ( a - [a] ) - a - [a] bfs next start = let xs = nub $ start : ( xs = next ) in xs but it has a problem: it only works for infinite graphs. This is fine: take 20 $ bfs ( \ x -

[Haskell-cafe] Re: Remote invocations in Haskell?

2010-03-25 Thread Gleb Alexeyev
Yves Parès wrote: Okay, well, apparently I have to rely on an external HTTP server. This is not very simple, is there another more suitable way to get RPC working in haskell? Apparently it is possible to use Happstack as webserver, here's example I came up with: import

[Haskell-cafe] phonetic dictionnary

2010-03-25 Thread Dupont Corentin
Hello, sorry if i ask a lot of questions these days! Do you know of a phonetic dictionnary? i'm very fond of enigmas. To solve certain enigmas, i've made a little program that search into a french dictionnary. But it would be much better if i could search into a phonetic dictionnary... The goal

Re: [Haskell-cafe] phonetic dictionnary

2010-03-25 Thread Paul Brauner
You should have a looks at soundexes: http://en.wikipedia.org/wiki/Soundex the algorithm is really simple and you can process a whole dictionnary in no time to obtain what you're looking for. Paul On Thu, Mar 25, 2010 at 01:59:28PM +0100, Dupont Corentin wrote: Hello, sorry if i ask a lot of

Re: [Haskell-cafe] explicit big lambdas

2010-03-25 Thread Paul Brauner
Thanks to all! Paul On Fri, Mar 19, 2010 at 04:24:17PM +0100, Bas van Dijk wrote: On Fri, Mar 19, 2010 at 4:03 AM, Nicolas Frisby nicolas.fri...@gmail.com wrote: Alternatively: let f :: some type involving a    f = ...    f' :: a - some type involving a    f' _ = f in f'

Re: [Haskell-cafe] phonetic dictionnary

2010-03-25 Thread Dupont Corentin
Hello, i've allready looked at soundex. But it's too simple for what i need. For example the hash code for toto and tata is the same, if i remember. But those two doesn't rhymes. Co On 3/25/10, Paul Brauner paul.brau...@loria.fr wrote: You should have a looks at soundexes:

[Haskell-cafe] Re: [Haskell] ANN: Yi 0.6.2.2

2010-03-25 Thread Jeff Wheeler
On Thu, Mar 25, 2010 at 7:48 AM, John Lato jwl...@gmail.com wrote: Will it work if you set data-accessor-template 0.2.1.3 in the .cabal file?  I think that version is acceptable to both ghc-6.10 and 6.12. It seems so, yes. Unfortunately, I've already made other changes to HEAD that are

[Haskell-cafe] libraries and executables in cabal

2010-03-25 Thread Paul Brauner
Hi, i'm working on a project made of - lots of modules - one excutable importing these modules - another excutable importing these same modules I don't especially want to expose those modules as libraries, especially on hackage, since they are meaningless without the executables. But, if I

Re: [Haskell-cafe] Asynchronous exception wormholes kill modularity

2010-03-25 Thread Twan van Laarhoven
Bas van Dijk wrote: ... However now comes the problem I would like to talk about. What if I want to use modifyMVar_ as part of a bigger atomic transaction. As in: block $ do ... modifyMVar_ m f ... From a quick glanse at this code it looks like asynchronous exceptions

Re: [Haskell-cafe] phonetic dictionnary

2010-03-25 Thread Dupont Corentin
Thanks, this dictionnary is exactly what i wanted! Too bad it doesn't exists in French! On 3/25/10, Max Rabkin max.rab...@gmail.com wrote: There is the CMU phonetic dictionary for English at http://www.speech.cs.cmu.edu/cgi-bin/cmudict but I know of nothing for French. Perhaps there is an

Re: [Haskell-cafe] libraries and executables in cabal

2010-03-25 Thread Henning Thielemann
Paul Brauner schrieb: Hi, i'm working on a project made of - lots of modules - one excutable importing these modules - another excutable importing these same modules I don't especially want to expose those modules as libraries, especially on hackage, since they are meaningless

Re: [Haskell-cafe] double existential type

2010-03-25 Thread Ozgur Akgun
I tried forall a,b. Binary' a b and the *what was I thinking* comment was for that. And I absulutely agree with you on the nesting part. That's what came to my mind at the first glance for obvious reasons. On 24 March 2010 20:27, Bas van Dijk v.dijk@gmail.com wrote: On Wed, Mar 24, 2010 at

[Haskell-cafe] existentially quantified data types - restrictions

2010-03-25 Thread Ozgur Akgun
Dear Cafe, I need to use a language feature which is explicitly documented to be a restriction, and -even worse- I think I reasonably need to use it. f2 (Baz1 a b) (Baz1 p q) = a==q It's ok to say a==b or p==q, but a==q is wrong because it equates the two distinct types arising from the two

Re: [Haskell-cafe] existentially quantified data types - restrictions

2010-03-25 Thread andy morris
Can you have Typeable as an extra constraint? If so: {-# LANGUAGE ExistentialQuantification #-} import Data.Typeable data Baz = forall a. (Eq a, Typeable a) = Baz a instance Eq Baz where Baz x == Baz y = case cast y of Just y' - x == y' Nothing - False ghci Baz

Re: [Haskell-cafe] existentially quantified data types - restrictions

2010-03-25 Thread Ozgur Akgun
Looks great! I started searching on how to write my own Typeable instances, but then I found the language extension *DeriveDataTypeable*, and now everything work like a charm. Thanks very much! On 25 March 2010 15:13, andy morris a...@adradh.org.uk wrote: Can you have Typeable as an extra

[Haskell-cafe] Is hGetLine lazy like hGetContents? And what about this todo item?

2010-03-25 Thread Jason Dagit
Hello, I was trying to figure out if hGetLine is safe to use inside of withFile. Specifically, I want to return the line I read and use it later, without inspecting it before withFile calls hClose. If you want to understand the concern I have, look here:

Re: [Haskell-cafe] existentially quantified data types - restrictions

2010-03-25 Thread Alex Rozenshteyn
I think type witnesses *might* be relevant to your interests. On Thu, Mar 25, 2010 at 11:13 AM, andy morris a...@adradh.org.uk wrote: Can you have Typeable as an extra constraint? If so: {-# LANGUAGE ExistentialQuantification #-} import Data.Typeable data Baz = forall a. (Eq a,

Re: [Haskell-cafe] existentially quantified data types - restrictions

2010-03-25 Thread Ozgur Akgun
[for future reference] After looking into the *cast* function a little bit more, I think we can simply get rid of the case expression: data Baz = forall a. (Eq a, Typeable a) = Baz a instance Eq Baz where Baz x == Baz y = cast x == Just y On 25 March 2010 15:13, andy morris

[Haskell-cafe] Re: Is hGetLine lazy like hGetContents? And what about this todo item?

2010-03-25 Thread Simon Marlow
On 25/03/2010 15:40, Jason Dagit wrote: Hello, I was trying to figure out if hGetLine is safe to use inside of withFile. Specifically, I want to return the line I read and use it later, without inspecting it before withFile calls hClose. If you want to understand the concern I have, look

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-25 Thread Simon Marlow
On 25/03/2010 11:57, Bas van Dijk wrote: Dear all, (sorry for this long mail) When programming in the IO monad you have to be careful about asynchronous exceptions. These nasty little worms can be thrown to you at any point in your IO computation. You have to be extra careful when doing, what

[Haskell-cafe] Re: Is hGetLine lazy like hGetContents? And what about this todo item?

2010-03-25 Thread Jason Dagit
On Thu, 2010-03-25 at 16:13 +, Simon Marlow wrote: On 25/03/2010 15:40, Jason Dagit wrote: Hello, I was trying to figure out if hGetLine is safe to use inside of withFile. Specifically, I want to return the line I read and use it later, without inspecting it before withFile calls

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-25 Thread Bas van Dijk
On Thu, Mar 25, 2010 at 5:36 PM, Simon Marlow marlo...@gmail.com wrote: Nice, I hadn't noticed that you can now code this up in the library since we added 'blocked'.  Unfortunately this isn't cheap: 'blocked' is currently an out-of-line call to the RTS, so if we want to start using it for

Re: [Haskell-cafe] Re: Is hGetLine lazy like hGetContents? And what about this todo item?

2010-03-25 Thread Bas van Dijk
On Thu, Mar 25, 2010 at 6:07 PM, Jason Dagit da...@galois.com wrote: What is the next step for getting rid of the obsolete comment?  Did you already nuke it?  If not, I could try to get a copy of the ghc repo and see if I can figure out the right protocol for submitting a patch. Making library

Re: [Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-25 Thread Steve Schafer
On Thu, 25 Mar 2010 18:16:07 +0100, you wrote: Yes counting the nesting level like Twan proposed will definitely solve the modularity problem. I do think we need to optimize the block and unblock operations in such a way that they don't need to use IORefs to save the counting level. The version

Re: [Haskell-cafe] haskell platform questions

2010-03-25 Thread John Velman
I had the same problem -- downloaded and installed the new Haskell Platform, and when I tried cabal I got the: dyld error. I'm also on OS X 10.5.8. Also, ghc users guide appears to be missing. I filed a bug report. To solve the cabal problem I got cabal-install version 0.9.0

Re: [Haskell-cafe] haskell platform questions

2010-03-25 Thread Don Stewart
velman: I had the same problem -- downloaded and installed the new Haskell Platform, and when I tried cabal I got the: dyld error. I'm also on OS X 10.5.8. Also, ghc users guide appears to be missing. I filed a bug report. To solve the cabal problem I got cabal-install version

Re: [Haskell-cafe] haskell platform questions

2010-03-25 Thread Gregory Collins
Don Stewart d...@galois.com writes: velman: I had the same problem -- downloaded and installed the new Haskell Platform, and when I tried cabal I got the: dyld error. I'm also on OS X 10.5.8. Also, ghc users guide appears to be missing. I filed a bug report. To solve the cabal

[Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-03-25 Thread Bardur Arantsson
On 2010-02-24 20:50, Brandon S. Allbery KF8NH wrote: tcpdump 'host ps3 and tcp[tcpflags] 0x27 != 0' (Indulging in some serious thread necromancy here, but...) Alright, I've _finally_ got round to doing a dump with leaking file descriptors (or threads as the case may be). The bits of lsof

[Haskell-cafe] ANNOUNCE: cuboid 0.12: 3D Yampa/GLUT Puzzle Game

2010-03-25 Thread Pedro Martins
Hi all, Recently, I have been playing around a bit with Yampa and GLUT, integrating them and trying to develop a simple 3D game within the framework. As it involved quite a bit of source code reading from Yampa and Frag (thanks to both!), I have decided to upload the game to Hackage, to help

[Haskell-cafe] HLIst - how to use TIPTransform with functions that run in the IO monad?

2010-03-25 Thread Andrew U. Frank
i use the TIPTransform module that Oleg has provided - very nice and easy to use! Thank you Oleg!! now i run into a problem, i seem not to be able to resolve: how to use TIPTransform with functions that use the IO monad? considering the example tip5 in Olegs communiation, where he uses a

[Haskell-cafe] Re: Is hGetLine lazy like hGetContents? And what about this todo item?

2010-03-25 Thread Simon Marlow
On 25/03/10 17:07, Jason Dagit wrote: On Thu, 2010-03-25 at 16:13 +, Simon Marlow wrote: On 25/03/2010 15:40, Jason Dagit wrote: Hello, I was trying to figure out if hGetLine is safe to use inside of withFile. Specifically, I want to return the line I read and use it later, without

[Haskell-cafe] Re: Is hGetLine lazy like hGetContents? And what about this todo item?

2010-03-25 Thread Jason Dagit
On Thu, 2010-03-25 at 21:38 +, Simon Marlow wrote: On 25/03/10 17:07, Jason Dagit wrote: On Thu, 2010-03-25 at 16:13 +, Simon Marlow wrote: On 25/03/2010 15:40, Jason Dagit wrote: Hello, I was trying to figure out if hGetLine is safe to use inside of withFile. Specifically, I

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-25 Thread Simon Marlow
On 25/03/10 17:16, Bas van Dijk wrote: On Thu, Mar 25, 2010 at 5:36 PM, Simon Marlowmarlo...@gmail.com wrote: Nice, I hadn't noticed that you can now code this up in the library since we added 'blocked'. Unfortunately this isn't cheap: 'blocked' is currently an out-of-line call to the RTS, so

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-25 Thread Bas van Dijk
On Thu, Mar 25, 2010 at 11:23 PM, Simon Marlow marlo...@gmail.com wrote: So I'm all for deprecating 'block' in favor of 'mask'. However what do we call 'unblock'? 'unmask' maybe? However when we have: mask $ mask $ unmask x and these operations have the counting nesting levels semantics,

[Haskell-cafe] Patch for library (new feature) - how to deal with it

2010-03-25 Thread Maciej Piechotka
Hello, I have written patch (attached) which introduce new API for zlib - personally I wrote it to have easy implementation of compression/decompression in iteratee (example file - no yet working -attached). Earlier version of patch I tried to sent to maintainer of zlib. However I received no

Re: [Haskell-cafe] Patch for library (new feature) - how to deal with it

2010-03-25 Thread Ivan Miljenovic
On 26 March 2010 13:11, Maciej Piechotka uzytkown...@gmail.com wrote: Earlier version of patch I tried to sent to maintainer of zlib. However I received no response. Probably because Duncan is (apparently) a very busy man: working, hacking, finishing off his thesis, etc. -- Ivan Lazar

Re: [Haskell-cafe] Re: sendfile leaking descriptors on Linux?

2010-03-25 Thread Brandon S. Allbery KF8NH
On Mar 25, 2010, at 15:03 , Bardur Arantsson wrote: On 2010-02-24 20:50, Brandon S. Allbery KF8NH wrote: tcpdump 'host ps3 and tcp[tcpflags] 0x27 != 0' The only striking thing I can see about the dump is that there are 22 (conspicuously close to 16) sequences like: 19:45:30.135291 IP

[Haskell-cafe] Re: Asynchronous exception wormholes kill modularity

2010-03-25 Thread Brandon S. Allbery KF8NH
On Mar 25, 2010, at 19:16 , Bas van Dijk wrote: But with regard to naming, I think the name 'unmask' is a bit misleading because it doesn't unmask asynchronous exceptions. What it does is remove a layer of masking so to speak. I think the names of the functions should reflect the nesting or

Re: [Haskell-cafe] Asynchronous exception wormholes kill modularity

2010-03-25 Thread Matthew Brecknell
Hi Bas, Bas van Dijk wrote: block $ do ... modifyMVar_ m f ... From a quick glanse at this code it looks like asynchronous exceptions can't be thrown to this transaction because we block them. However the unblock in modifyMVar_ opens an asynchronous exception