[Haskell-cafe] Converting String

2004-01-26 Thread Alex Gontcharov
Hi, I'm fairly new to Haskell, I'd like to know how to convert a list of Strings of type IO [String] to Int. I used map read p, where p is a list of IO Strings [1, 2] Thanks ___ Haskell-Cafe mailing list [EMAIL PROTECTED]

Re: [Haskell-cafe] Converting String

2004-01-26 Thread Derek Elkins
On Mon, 26 Jan 2004 18:05:16 +1030 Alex Gontcharov [EMAIL PROTECTED] wrote: Hi, I'm fairly new to Haskell, I'd like to know how to convert a list of Strings of type IO [String] to Int. I used map read p, where p is a list of IO Strings [1, 2] http://www.haskell.org/tutorial/

Re: [Haskell-cafe] Converting String

2004-01-26 Thread Keith Wansbrough
Derek Elkins writes: On Mon, 26 Jan 2004 18:05:16 +1030 Alex Gontcharov [EMAIL PROTECTED] wrote: I'm fairly new to Haskell, I'd like to know how to convert a list of Strings of type IO [String] to Int. I used map read p, where p is a list of IO Strings [1, 2]

Re: [Haskell-cafe] Interpreting fields in a buffer

2004-01-26 Thread Alastair Reid
I have a question related to a program I'm writing. I have to handle IP packets, which will be read into a buffer. What is the best haskell idiom for getting access to the fields in the buffer? There's no way in Haskell to define a datastructure with a particular memory layout. (Strictly,

Re: [Haskell-cafe] Interpreting fields in a buffer

2004-01-26 Thread Tomasz Zielonka
On Mon, Jan 26, 2004 at 10:34:06AM +, Alastair Reid wrote: To access the fields, you will need to write a bunch of functions to read them out (and write them if you need). There's basically two approaches: 1) Write access functions in C and use the ffi interface to call them. For

Re: [Haskell-cafe] Interpreting fields in a buffer

2004-01-26 Thread Glynn Clements
Alastair Reid wrote: 2) Write access functions in Haskell using functions from the Storable class and associated libraries. In this case, using Storable probably isn't worth the trouble, given that 1. The 16- and 32-bit fields are in network byte order, whereas Storable assumes host byte

[Haskell-cafe] Re: [Haskell] Re: Use of tab characters in indentation-sensitive code

2004-01-26 Thread Graham Klyne
[Switching to Haskell-cafe] At 11:38 26/01/04 +0100, Andreas Rossberg wrote: The most flexible but safe solution is to simply define the indentation as the sequence of indentation characters used. Two consecutive lines are indented consistently whenever one indentation is a prefix of the other.

[Haskell-cafe] RE: [Haskell] Gallopping Tab characters

2004-01-26 Thread Simon Marlow
Simon Marlow wrote: As for the width of the tab character: tab stops are every 8 columns. Period. The Haskell report says so Yes, true. I think it was Leslie Lamport who wrote in TeXHaX that anyone defining an input format which includes tabs should be sentenced to ten years

[Haskell-cafe] Re: Simple Fudgets-question

2004-01-26 Thread Henrik Berg
Thomas Hallgren [EMAIL PROTECTED] writes: Henrik Berg wrote: Hi! I can't find any function in the Fudgets-library to do this: (F a b) - (F a (a, b)) ... All I want to do is to resend the input out on the output. If that is all you want, this combinator is the right choice:

[Haskell-cafe] Matrix as list of list

2004-01-26 Thread Pajo Patak
Hello i am new to Haskell and i could need some help :) I want to make a function getElement which returns me an Element from a martix, which ist represented as a list of lists, e.g. [[1,2,3] [4,5,6]] is a 2x3 Matrix. The Type of the function getElement is Int-Int-[[a]]-a Can someone help me

Re: [Haskell-cafe] Interpreting fields in a buffer

2004-01-26 Thread Mikael Brockman
On mån, 2004-01-26 at 12:22 -0500, Gregory Wright wrote: Hi Dominic, First, thanks to everyone for their help. RIght now, I'm leaning toward Dominic's solution of a collection of helper functions, but I have the feeling that we should be generating them automatically. After all, given a

[Haskell-cafe] Re: Simple Fudgets-question

2004-01-26 Thread Thomas Hallgren
Henrik Berg wrote: Thomas Hallgren [EMAIL PROTECTED] writes: ... All I want to do is to resend the input out on the output. If that is all you want, this combinator is the right choice: throughF :: F a b - F a (Either b a) Yes, but (Either b a) won't give me the input _together_

Re: [Haskell-cafe] Interpreting fields in a buffer

2004-01-26 Thread Gregory Wright
Mikael, Thanks, that's very helpful and seems to be just the sort of thing I'm looking for. Greg On Jan 26, 2004, at 6:05 PM, Mikael Brockman wrote: You'll probably want to take a look at Erlang's so called ``bit syntax'' at http://www.erlang.se/euc/00/bit_syntax.html. It's very nifty, and I'd