Hi,
Hmm, have the new xlib bindings been tested? For instance, when I run
the following program:
module Main where
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Display
main :: IO ()
main = do
display - openDisplay
Does anyone know why these are in the IO monad? Aren't they pure functions
converting between dotted-decimal strings and a 32-bit network byte ordered
binary value?
Dominic.
http://www.haskell.org/ghc/docs/latest/html/libraries/network/Network.Socket.html#v%3Ainet_addr
Below is the relevant source code.
David
foreign import ccall unsafe my_inet_ntoa
c_inet_ntoa :: HostAddress - IO (Ptr CChar)
foreign import CALLCONV unsafe inet_addr
c_inet_addr :: Ptr CChar - IO HostAddress
-- -
On 5/7/05, Dominic Steinitz [EMAIL PROTECTED] wrote:
Does anyone know why these are in the IO monad? Aren't they pure functions
converting between dotted-decimal strings and a 32-bit network byte ordered
binary value?
I guess the answer is no for both: The first one can fail and the second
Axel Simon wrote:
Does anyone know why these are in the IO monad? Aren't they pure functions
converting between dotted-decimal strings and a 32-bit network byte
ordered
binary value?
I guess the answer is no for both: The first one can fail
That doesn't mean that it should be in
On 5/5/05, S. Alexander Jacobson [EMAIL PROTECTED] wrote:
On Tue, 3 May 2005, Samuel Bronson wrote:
Maybe something like
from Text.HaXML.XML import (Types, Escape, Pretty)
would be nice.
The problem with this one is that you need a way to express all the
other stuff in import
I wrote this up a few days ago and thought I'd share it with the list.
It's yet another implementation of fixed-length vectors (that is, lists
which reflect their length in their type). It's a nice demonstration of
GADTs and an unexpected use of a technique Ralf Hinze describes in
Generics for the
This is the second of two modules implementing fixed-length vectors in
Haskell. The first used GADTs, a recent extension which currently
requires GHC 6.4. This module uses no extensions to Haskell 98.
This message is literate Haskell. To use, save it as Vector_H98.lhs.
module Vector_H98 where
Max Vasin wrote:
But why do you need that? Where do need to make an assumption about the size
of the list?
I'm implementing the RC4 algorithm, which requires a state array with
256 elements containing the bytes from 0 to 255. As the algorithm
progresses, the elements of the array get shuffled
At 9:24 AM -0400 2005/5/7, Daniel Carrera wrote:
Hello,
Right now I'm using type declarations like:
f :: Int - [Int]
So f returns a list of Ints.
Is there a way to tell Haskell that a list or array must have
exactly (say) 256 elements? I'd love to have Haskell make sure that
the array I build is
Hamilton Richards wrote:
Well, for starters, lists and arrays are two entirely different topics.
I've noticed that Haskell newbies sometimes confuse them --possibly the
use of [] in list types and enumerations triggers an unconscious
association with [] used in conventional languages for array
On 5/7/05, Daniel Carrera [EMAIL PROTECTED] wrote:
Hamilton Richards wrote:
Well, for starters, lists and arrays are two entirely different topics.
I've noticed that Haskell newbies sometimes confuse them --possibly the
use of [] in list types and enumerations triggers an unconscious
On 20050507T093613-0700, Fergus Henderson wrote:
On 07-May-2005, Hamilton Richards [EMAIL PROTECTED] wrote:
As far as I know, the last programming language that included
arrays' sizes in their types was Standard Pascal,
There have been many such languages since Standard Pascal. For
On 5/7/05, Daniel Carrera [EMAIL PROTECTED] wrote:
Stefan Monnier wrote:
I have a lady friend who wants to learn how to program. She's a technical
person, but has no math background to speak of. I can't decide whether to
start with a clear-syntax imperative language (Ruby) or a functional
Antti-Juhani Kaijanaho [EMAIL PROTECTED] writes:
As far as I know, the last programming language that included
arrays' sizes in their types was Standard Pascal,
There have been many such languages since Standard Pascal. For
example C, C++, C#, Java, Ada, VHDL, and NU-Prolog.
C, C++ and
Sebastian Sylvan [EMAIL PROTECTED] writes:
A list is, for me, more of a logical entity (as opposed to
structural). It's a sequence of stuff not a particular way to
store it (singly-linked, doubly-linked, arraylists etc.).
I call it sequence.
A list is usually a concrete type in a given
Daniel Carrera [EMAIL PROTECTED] writes:
$ nhc98 prng.hs -o prng
I/O error (user-defined), call to function `userError':
In file ./RC4.hi:
1:1-1:6 Found _module_ but expected a interface
GHC and NHC confuse each other with prng.hi files they produce and
examine, in incompatible formats.
Marcin 'Qrczak' Kowalczyk wrote:
$ nhc98 prng.hs -o prng
I/O error (user-defined), call to function `userError':
In file ./RC4.hi:
1:1-1:6 Found _module_ but expected a interface
GHC and NHC confuse each other with prng.hi files they produce and
examine, in incompatible formats.
You can delete
No, it introduces a variable of type array of 50 ints, which can be
converted to pointer to int.
It matters when you make a pointer of such arrays, an array of such
arrays, or sizeof such array. In C++ the size can be matched by
template parameter, and you can have separate overloadings for
On 20050507T203246+0200, Marcin 'Qrczak' Kowalczyk wrote:
In C and C++, the declaration int n[50]; introduces an array variable
with size 50 having the type array of int. The size is *not* part of
the type.
No, it introduces a variable of type array of 50 ints, which can be
converted to
GCC knows how big an array is:
jake$ cat arrsizetest.c
#include stdio.h
int main()
{
int a[50];
printf(sizeof a == %d\n,sizeof(a));
return 0;
}
jake$ gcc arrsizetest.c
jake$ ./a.out
sizeof a == 200
jacob
On Sat, 7 May 2005, Thomas Davie wrote:
No, it introduces a variable
Thomas Davie [EMAIL PROTECTED] writes:
I'm not familiar with your C++ example (not being familiar with C++),
but I think that it's a bit of a stretch of the imagination to say
that C introduces a variable of type array of 50 ints, the fact
that this is now an array of 50 integers is never
On 20050507T120430-0400, Daniel Carrera wrote:
I think it's because there's no real reason for someone to think that
the words list and array might not be synonims. I certainly don't
seen a linguistic distinction. Either term refers to an ordered
collection of items.
I don't even know what
Antti-Juhani Kaijanaho wrote:
Your mistake is the start talking about groups as you do in every day
English part.
The point I'm trying to make is that you can't necessarily predict that
a programming language will abscribe special meaning to standard known
words like group or list. I can very
On 7 May, Daniel Carrera wrote:
Hello,
Right now I'm using type declarations like:
f :: Int - [Int]
So f returns a list of Ints.
Is there a way to tell Haskell that a list or array must have exactly
(say) 256 elements? I'd love to have Haskell make sure that the array I
build is
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
Thomas Davie [EMAIL PROTECTED] writes:
I'm not familiar with your C++ example (not being familiar with C++),
but I think that it's a bit of a stretch of the imagination to say
that C introduces a variable of type array of 50 ints, the
On Sat, 7 May 2005, Abraham Egnor wrote:
So does ghc:
...
That doesn't mean the size is part of the *type*.
Sure. I'm just pointing out that
int a[50];
is not *quite* the same as
int *a = (int *)malloc(50 * sizeof(int));
jacob
___
Haskell-Cafe
On Sat, May 07, 2005 at 08:20:15PM +0100, Thomas Davie wrote:
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
The size is taken into account when such array type is an element of
another array, and by sizeof.
int (*p)[50]; /* p may legally point only to arrays of 50 ints each */
Daniel Carrera writes:
Hello,
After days of effort, I finally managed to compile and install a
Haskell compiler. The one I have is NHC98.
So now, with my new toy, I am eager to compile my very first Haskell
program (I've been using 'runhugs' so far). But I'm having problems:
Incidentally, if you aren't already familiar with make or some other
build system, I strongly recommend looking into one. Even for a
project
with only two files, having a build system keep track of compilation
dependencies makes things a lot less tedious.
In random addition to this... hmake will
David Roundy [EMAIL PROTECTED] writes:
No, int (*p)[50] is a multidimensional array, one of the most useless
concepts in C, and is equivalent to int p[50][] (or is it p[][50]...
I always get my matrix subscripts messed up).
No, it's not equivalent to either. Array type are not the same as
David Menendez wrote:
*.hi files are analogous to C's *.h files, except that the compiler
generates them.
Thanks, I learned something new today.
You mentioned later that you don't have any *.hi files, so I'm guessing
you didn't compile RC4.hs before you compiled prng.hs.
Correct. I didn't know I
On 20050507T212832+0200, Marcin 'Qrczak' Kowalczyk wrote:
ISO 9899:1999 (C99) section 6.7.5.2:3 says that its type is array of
int, not array of 50 ints:
Ok, so in C terminology type is different from most statically typed
languages in this respect. The dimension is used together with the
At 9:36 AM -0700 2005/5/7, Fergus Henderson wrote:
On 07-May-2005, Hamilton Richards [EMAIL PROTECTED] wrote:
As far as I know,
the last programming language that included arrays' sizes in their
types was Standard Pascal,
There have been many such languages since Standard Pascal.
For example C,
Hamilton Richards [EMAIL PROTECTED] writes:
That's not the case in C, C++, Java, or Ada. In C and C++, for
example, given two arrays
int X[50];
int Y[100];
and a function declared as
void P( int a[] )
then these calls
P( X )
P( Y )
are both valid,
At 12:04 PM -0700 2005/5/7, Jacob Nelson wrote:
GCC knows how big an array is:
jake$ cat arrsizetest.c
#include stdio.h
int main()
{
int a[50];
printf(sizeof a == %d\n,sizeof(a));
return 0;
}
jake$ gcc arrsizetest.c
jake$ ./a.out
sizeof a == 200
jacob
gcc knows the size of
No look, I don't have /any/ .hi files. I don't know what a .hi file is.
I don't have GHC either, I've never managed to make it compile. I just
got my very first Haskell compiler (literally 10min ago).
Cheers,
Daniel.
Just out of curiosity, what platform are you on? There seem to be
builds
Cale Gibbard wrote:
Just out of curiosity, what platform are you on? There seem to be
builds of GHC available for most common ones.
Solaris :-(
I hate Solaris. No, I didn't choose it; this is what the school
provides. But if all goes well, I'll have my very own Ubuntu Linux box
within a month or
38 matches
Mail list logo