Re: [Haskell-cafe] Missing Network Functions

2008-12-28 Thread Johan Tibell
2008/12/28 Bryan O'Sullivan b...@serpentine.com: 2008/12/27 John Van Enk vane...@gmail.com Currently this only has: htons htonl ntohs ntohl This is all subsumed by the binary package (Data.Binary), where it makes a lot more sense in any instance. That seems like an awfully heavy

Re: [Haskell-cafe] Missing Network Functions

2008-12-28 Thread Thomas DuBuisson
Didn't reply to all. Sorry for the double Johan. Johan asked: will GHC be able to optimize away all of the Data.Binary stuff so the functions, if defined in terms of Data.Binary, are as efficient as a direct implementation? Binary can be a bit slower than you might want. I'm guessing it

[Haskell-cafe] Data.ByteString join

2008-12-28 Thread Galchin, Vasili
Hello, http://cvs.haskell.org/Hugs/pages/libraries/base/Data-ByteString.html but vigalc...@ubuntu:~$ ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ... linking ... done. Prelude :m +Data.ByteString Prelude Data.ByteString :t join interactive:1:0:

Re: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Martijn van Steenbergen
It might be because you're looking at Hugs docs while using GHC. Galchin, Vasili wrote: Hello, http://cvs.haskell.org/Hugs/pages/libraries/base/Data-ByteString.html but vigalc...@ubuntu:~$ ghci GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help Loading package base ...

Re: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Galchin, Vasili
no Martijn ... I am using ghci ... not Hugs On Sun, Dec 28, 2008 at 4:02 AM, Martijn van Steenbergen mart...@van.steenbergen.nl wrote: It might be because you're looking at Hugs docs while using GHC. Galchin, Vasili wrote: Hello,

[Haskell-cafe] Re: Missing Network Functions

2008-12-28 Thread ChrisK
John Van Enk wrote: I want to group them with Network functions because traditionally these specific functions *are* in networking packages. I agree. It is true that these functions are in the arpa/inet.h header on my machine. The ntoh* and hton* are just data manipulation, just as

Re: Re[2]: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Galchin, Vasili
ooops ... .my bad ... so I guess Hoogle is the way to go?? On Sun, Dec 28, 2008 at 5:39 AM, Bulat Ziganshin bulat.zigans...@gmail.comwrote: Hello Vasili, Sunday, December 28, 2008, 1:59:43 PM, you wrote: http://cvs.haskell.org/Hugs/pages/libraries/base/Data-ByteString.html look carefully

Re: Re[2]: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Galchin, Vasili
Hoogle is my friend?! On Sun, Dec 28, 2008 at 5:49 AM, Galchin, Vasili vigalc...@gmail.comwrote: ooops ... .my bad ... so I guess Hoogle is the way to go?? On Sun, Dec 28, 2008 at 5:39 AM, Bulat Ziganshin bulat.zigans...@gmail.com wrote: Hello Vasili, Sunday, December 28, 2008, 1:59:43

Re: [Haskell-cafe] chroot a single thread

2008-12-28 Thread Christopher Lane Hinson
Well, IIUC, chroot operates at the process level. I don't think that chrooting a lightweight haskell thread using FFI can ever make sense. I see two cases here: 1) You actually want to chroot lightweight threads. In this case, write a little ChRoot wrapper monad around IO that supports

Re: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Brandon S. Allbery KF8NH
On 2008 Dec 28, at 5:59, Galchin, Vasili wrote: no Martijn ... I am using ghci ... not Hugs On Sun, Dec 28, 2008 at 4:02 AM, Martijn van Steenbergen mart...@van.steenbergen.nl wrote: It might be because you're looking at Hugs docs while using GHC. Galchin, Vasili wrote:

[Haskell-cafe] Re: Request for feedback: Understanding Haskell Monads

2008-12-28 Thread Ertugrul Soeylemez
Ertugrul Soeylemez e...@ertes.de wrote: In the last few weeks I have written a comprehensive tutorial about Haskell monads [1], and I was hoping to get some constructive feedback. I'd appreciate any well meant criticism. [1] http://ertes.de/articles/monads.html Thank you all for your

Re: [Haskell-cafe] What are side effects in Haskell?

2008-12-28 Thread Hans van Thiel
On Sat, 2008-12-27 at 11:54 -0600, Jake McArthur wrote: Hans van Thiel wrote: However, some functions in Haskell may have side effects, like printing something on the screen, updating a database, or producing a random number. These functions are called 'actions' in Haskell. Not really

Re: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Duncan Coutts
On Sun, 2008-12-28 at 03:54 -0600, Galchin, Vasili wrote: Prelude :m +Data.ByteString Prelude Data.ByteString :t join interactive:1:0: Not in scope: `join' Prelude Data.ByteString Why no join function? Because we removed it from the bytestring package in version 0.9. It had been

Re: [Haskell-cafe] chroot a single thread

2008-12-28 Thread Duncan Coutts
On Sun, 2008-12-28 at 00:22 -0500, Jeremy Shaw wrote: At Sat, 27 Dec 2008 22:41:58 -0600, brian wrote: On Sat, Dec 27, 2008 at 8:01 PM, Jeremy Shaw jer...@n-heptane.com wrote: The problem with that function is that chroot affects the root of the whole process. Yeah. Maybe you

Re: [Haskell-cafe] Missing Network Functions

2008-12-28 Thread Bryan O'Sullivan
On Sun, Dec 28, 2008 at 1:38 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: getNthWord n bs@(PS ptr off len) = inlinePerformIO $ withForeignPtr ptr $ \ptr' - do let p = castPtr $ plusPtr ptr' off peekElemOff p n But even this low

Re: [Haskell-cafe] Request for feedback: Understanding Haskell Monads

2008-12-28 Thread Hans van Thiel
On Sat, 2008-12-27 at 02:35 +0100, Ertugrul Soeylemez wrote: Hello fellow Haskellers, In the last few weeks I have written a comprehensive tutorial about Haskell monads [1], and I was hoping to get some constructive feedback. I'd appreciate any well meant criticism. [1]

Re: [Haskell-cafe] Missing Network Functions

2008-12-28 Thread Duncan Coutts
On Sun, 2008-12-28 at 08:47 -0800, Bryan O'Sullivan wrote: On Sun, Dec 28, 2008 at 1:38 AM, Thomas DuBuisson thomas.dubuis...@gmail.com wrote: getNthWord n bs@(PS ptr off len) = inlinePerformIO $ withForeignPtr ptr $ \ptr' - do

[Haskell-cafe] Re: Incremental trasnformations (not Haskell topic)

2008-12-28 Thread frantisek kocun
Still nobody? Maybe I didn't write it clear. So one more time: I have a list of numbers (say Int) numberList = [1:Int,2,3,1,2,6,7,8] and a number sumOfNumberList = sum numberList and here comes the question. Imagine the list numberLists is mutable (that's why in topic is not Haskell question) so

Re: [Haskell-cafe] Re: Incremental trasnformations (not Haskell topic)

2008-12-28 Thread Ryan Ingram
See Adaptive Functional Programming by Acar et al. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.61.2257 Doesn't talk about OO specifically, but rather how to make updatable computations in a mutable language. There's a Haskell implementation, too.

Re: [Haskell-cafe] Fram

2008-12-28 Thread Haakon Meland Eriksen
Gwern Branwen wrote: What advantages does Fram have over noweb? I've noodled around a little on the Literate Programs wiki ( http://en.literateprograms.org/ ) which uses noweb for providing the source files, and it seemed to work as it should. I've put together a small introduction to Haskell

Re: [Haskell-cafe] Fram

2008-12-28 Thread Haakon Meland Eriksen
Here is a direct link http://far.no/fram/index.php?title=Introduction_to_Haskell Haakon http://far.no/fram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] generating random lists until some predicate holds

2008-12-28 Thread Nicholas O. Andrews
Hi all, What's the best way to implement the following Python code in Haskell? It is purposefully written in a functional style (and as a result will kill your recursion stack every other run). # begin Python from random import * def genList (): return [randint(0,9) for x in range(10)] def

Re: [Haskell-cafe] generating random lists until some predicate holds

2008-12-28 Thread Luke Palmer
On Sun, Dec 28, 2008 at 2:39 PM, Nicholas O. Andrews nandr...@vt.eduwrote: Hi all, What's the best way to implement the following Python code in Haskell? It is purposefully written in a functional style (and as a result will kill your recursion stack every other run). Here's my solution,

Re: [Haskell-cafe] Re: Incremental trasnformations (not Haskell topic)

2008-12-28 Thread frantisek kocun
Thanks Ingram. It seems to be exactly what I was searching for:-) I knew I can rely on Haskellers.. This is from abstract ( http://ttic.uchicago.edu/~umut/papers/toplas06.pdf): We present techniques for incremental computing by introducing adaptive functional programming. As an adaptive program

Re: [Haskell-cafe] generating random lists until some predicate holds

2008-12-28 Thread Peter Verswyvelen
I'll give it shot, but I'm also learning Haskell, so take this with a grain of salt :) randWhile :: ([Int]-Bool) - StdGen - [Int] randWhile predicate = head . filter predicate . blocks 10 . randomRs (0,9) where blocks n xs = let (y,ys) = splitAt n xs in y : blocks n ys main = newStdGen

[Haskell-cafe] Re: Request for feedback: Understanding Haskell Monads

2008-12-28 Thread Ertugrul Soeylemez
Hans van Thiel hthiel.c...@zonnet.nl wrote: On Sat, 2008-12-27 at 02:35 +0100, Ertugrul Soeylemez wrote: In the last few weeks I have written a comprehensive tutorial about Haskell monads [1], and I was hoping to get some constructive feedback. I'd appreciate any well meant criticism.

Re: [Haskell-cafe] Re: Request for feedback: Understanding Haskell Monads

2008-12-28 Thread Luke Palmer
On Sun, Dec 28, 2008 at 3:58 PM, Ertugrul Soeylemez e...@ertes.de wrote: Hans van Thiel hthiel.c...@zonnet.nl wrote: On Sat, 2008-12-27 at 02:35 +0100, Ertugrul Soeylemez wrote: In the last few weeks I have written a comprehensive tutorial about Haskell monads [1], and I was hoping to

[Haskell-cafe] Cross compiling from Linux to windows?

2008-12-28 Thread Erik de Castro Lopo
Hi all, I've googled for this but haven't really found an answer yet. Is it possible to build (or better yet download) a GHC compiler that runs on Linux and generates windows binaries? I already use the MinGW C compiler to generate windows binaries from C code and I run my test suite under WINE.

Re: [Haskell-cafe] Re: Request for feedback: Understanding Haskell Monads

2008-12-28 Thread Henk-Jan van Tuyl
On Mon, 29 Dec 2008 00:21:02 +0100, Luke Palmer lrpal...@gmail.com wrote: On Sun, Dec 28, 2008 at 3:58 PM, Ertugrul Soeylemez e...@ertes.de wrote: Hans van Thiel hthiel.c...@zonnet.nl wrote: On Sat, 2008-12-27 at 02:35 +0100, Ertugrul Soeylemez wrote: In the last few weeks I have written

[Haskell-cafe] Transactional container for storing anonymous deletable objects

2008-12-28 Thread John Ky
Hi, I need a container data structure for storing anonymous objects - most likely things that have not value such as STM (), but probably other things as well. This will allow me to later on, iterate over the container and process those objects. Additionally I have the requirement that I need

Re: [Haskell-cafe] Transactional container for storing anonymous deletable objects

2008-12-28 Thread Luke Palmer
2008/12/28 John Ky newho...@gmail.com Hi, I need a container data structure for storing anonymous objects - most likely things that have not value such as STM (), but probably other things as well. This will allow me to later on, iterate over the container and process those objects.

Re: [Haskell-cafe] Transactional container for storing anonymous deletable objects

2008-12-28 Thread Antoine Latter
2008/12/28 Luke Palmer lrpal...@gmail.com: The hard way is a heteroeneous container, with an interface like: cons :: a - Container - IO (Key a) unlink :: Key a - Container - IO () toList :: ??? If you want to change that to: cons :: Typeable a = a - Container - IO (Key a) unlink ::

Re: [Haskell-cafe] Cross compiling from Linux to windows?

2008-12-28 Thread Jeff Zaroyko
On Mon, Dec 29, 2008 at 10:31 AM, Erik de Castro Lopo mle...@mega-nerd.com wrote: Hi all, I've googled for this but haven't really found an answer yet. Is it possible to build (or better yet download) a GHC compiler that runs on Linux and generates windows binaries? I already use the MinGW

Re: [Haskell-cafe] Transactional container for storing anonymous deletable objects

2008-12-28 Thread Marc Weber
Hi John Sorry, I don't think I really grasp your problem? I think you're mixing two things: a) which data type to use to store whatever you like? * http://haskell.org/haskellwiki/Existential_type * Typable and Data.Dynamic etc.. b) Which container to use to put in stuff, return an

[Haskell-cafe] IORef vs TVar performance: 6 seconds versus 4 minutes

2008-12-28 Thread Jim Snow
I decided to try to implement a graph algorithm using STM. Each node in the graph has a set of TVar-protected lists of the nodes it links to and the nodes that link to it. Also, there is a global TVar-protected Data.Map that contains all the nodes in the graph, indexed by name (which is

Re: [Haskell-cafe] Cross compiling from Linux to windows?

2008-12-28 Thread Erik de Castro Lopo
Jeff Zaroyko wrote: Hi Erik See http://haskell.org/haskellwiki/GHC_under_Wine Thanks Jeff, that works. Its not quite as convenient as a cross-compiler but will definitely do for now. Cheers, Erik -- - Erik de Castro Lopo

Re: [Haskell-cafe] Data.ByteString join

2008-12-28 Thread Galchin, Vasili
Thank Duncan, Martijn, Bulat and Brandon! Vasili On Sun, Dec 28, 2008 at 10:47 AM, Duncan Coutts duncan.cou...@worc.ox.ac.uk wrote: On Sun, 2008-12-28 at 03:54 -0600, Galchin, Vasili wrote: Prelude :m +Data.ByteString Prelude Data.ByteString :t join interactive:1:0: Not in scope:

[Haskell-cafe] represent data sturcture using function

2008-12-28 Thread Raeck chiu
Merry Christmas! Hope everybody is enjoying the Christmas! I am doing some readings and I found something seems to be interesting. People sometime will try to represent a quantity-regard-only data structure (such a order-regadless List) using functions instead of ta concrete data structure

Re: [Haskell-cafe] IORef vs TVar performance: 6 seconds versus 4 minutes

2008-12-28 Thread Ryan Ingram
Both readTVar and writeTVar are worse than O(1); they have to look up the TVar in the transaction log to see if you have made local changes to it. Right now it looks like that operation is O(n) where n is the number of TVars accessed by a transaction, so your big transaction which is just

Re: [Haskell-cafe] represent data sturcture using function

2008-12-28 Thread David Menendez
2008/12/29 Raeck chiu ra...@msn.com: People sometime will try to represent a quantity-regard-only data structure (such a order-regadless List) using functions instead of ta concrete data structure (like the haskell build-in []), any particular reason for this? For example, data Sex = Male |

Re: [Haskell-cafe] Cross compiling from Linux to windows?

2008-12-28 Thread Bulat Ziganshin
Hello Erik, Monday, December 29, 2008, 2:31:40 AM, you wrote: ghc doesn't support cross-compilation I've googled for this but haven't really found an answer yet. Is it possible to build (or better yet download) a GHC compiler that runs on Linux and generates windows binaries? I already use

Re: [Haskell-cafe] reactive? was Re: Incremental trasnformations (not Haskell topic)

2008-12-28 Thread Brandon S. Allbery KF8NH
On 2008 Dec 28, at 17:22, frantisek kocun wrote: We present techniques for incremental computing by introducing adaptive functional programming. As an adaptive program executes, the underlying system represents the data and control dependences in the execution in the form of a dynamic

Re: [Haskell-cafe] reactive? was Re: Incremental trasnformations (not Haskell topic)

2008-12-28 Thread Luke Palmer
2008/12/28 Brandon S. Allbery KF8NH allb...@ece.cmu.edu On 2008 Dec 28, at 17:22, frantisek kocun wrote: We present techniques for incremental computing by introducing adaptive functional programming. As an adaptive program executes, the underlying system represents the data and control

Re: [Haskell-cafe] reactive? was Re: Incremental trasnformations (not Haskell topic)

2008-12-28 Thread Derek Elkins
On Mon, 2008-12-29 at 01:20 -0500, Brandon S. Allbery KF8NH wrote: On 2008 Dec 28, at 17:22, frantisek kocun wrote: We present techniques for incremental computing by introducing adaptive functional programming. As an adaptive program executes, the underlying system represents the data

Re: [Haskell-cafe] IORef vs TVar performance: 6 seconds versus 4 minutes

2008-12-28 Thread Jim Snow
Thanks, that's good to know. I tried incrementally loading the graph one node per transaction. It's faster: about 38 seconds instead of 4 minutes, but I think I'll stick with IORefs and one thread for the present. -jim Ryan Ingram wrote: Both readTVar and writeTVar are worse than O(1);

Re: [Haskell-cafe] IORef vs TVar performance: 6 seconds versus 4 minutes

2008-12-28 Thread Evan Laforge
On Mon, Dec 29, 2008 at 1:15 PM, Ryan Ingram ryani.s...@gmail.com wrote: Both readTVar and writeTVar are worse than O(1); they have to look up the TVar in the transaction log to see if you have made local changes to it. Right now it looks like that operation is O(n) where n is the number of