Re: How to find out the C type signature corresponding to a Haskell function type in FFI?

2006-03-08 Thread Marcin 'Qrczak' Kowalczyk
Brian Hulley [EMAIL PROTECTED] writes: I've got a Haskell module with the following ffi import: foreign import ccall duma_init :: Int - IO Int However my problem is that I've got no idea what the type signature for the corresponding C function should be, HsInt duma_init(HsInt arg); Or use

Re: UTF-8 decoding

2006-02-11 Thread Marcin 'Qrczak' Kowalczyk
John Meacham [EMAIL PROTECTED] writes: Another possibility is quasi-utf8 encoding. where it passes through any invalid utf8 sequences as latin1 characters. in practice, this works very well as interpreting both latin1 and utf8 transparently but is more than somewhat hacky. It would not be

Re: Are new sequences really O(1)?

2005-05-31 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: Nice trick. Unfortunately the same assumptions don't hold for GHC's garbage collector - objects are aged in the youngest generation, so it is usually at least two GCs before an object is promoted. We could still do the same trick, but instead we'd have

Re: Are new sequences really O(1)?

2005-05-27 Thread Marcin 'Qrczak' Kowalczyk
[moved from libraries to glasgow-haskell-users] Ross Paterson [EMAIL PROTECTED] writes: GCs that happen during this process will be more expensive, as they have to scan the stack. I suspect that GC costs are swamping everything else for large n. I just tweaked the implementation GC in my

Re: Optimization and GCC?

2001-12-19 Thread Marcin 'Qrczak' Kowalczyk
Wed, 19 Dec 2001 09:56:36 +0100, Till Doerges [EMAIL PROTECTED] pisze: /u/joe/built/lib/ghc-5.00.2/includes/Regs.h:255: warning: call-clobbered register used for global register variable I don't know about this one. /tmp/ghc15733.hc:5391: warning: deprecated initialization of zero-length

Re: [qforeign] CursesTest segfaults

2001-12-02 Thread Marcin 'Qrczak' Kowalczyk
29 Nov 2001 18:12:08 +0900, Jens Petersen [EMAIL PROTECTED] pisze: I built qforeign from cvs under Linux. Any idea why tests/CursesTest segfaults? No idea - works for me now. ghc-5.03 ncurses-5.2 glibc-2.2.3 gmp-3.1.1 readline-4.2 -- __( Marcin Kowalczyk * [EMAIL PROTECTED]

Re: Casting dynamic values

2001-11-28 Thread Marcin 'Qrczak' Kowalczyk
27 Nov 2001 17:31:10 -0700, Alastair David Reid [EMAIL PROTECTED] pisze: If GHC is able to inline these functions, construction and deconstruction of the pair can probably be eliminated. cast is compiled to something similar to this: coerce :: a - b -- this generates no runtime code type

Re: hsc: Passing -1 as CString/Ptr a?

2001-11-22 Thread Marcin 'Qrczak' Kowalczyk
Thu, 22 Nov 2001 13:57:32 +0100, Volker Stolz [EMAIL PROTECTED] pisze: Hi, I want to invoke the C-function 'dlsym', which has three possible options for a parameter of type (void*): - NULL - void* to a string, i.e. CString in Haskell - RTLD_NEXT = (void *)(-1) You can obtain the value

Re: Reading files via http or ftp

2001-10-26 Thread Marcin 'Qrczak' Kowalczyk
25 Oct 2001 21:01:27 +0100, Colin Paul Adams [EMAIL PROTECTED] pisze: Has anyone used the Socket library to read files specified via an http and/or ftp URL? Yes (http), although I implemented only a small subset of the http client protocol. http://qrczak.ids.net.pl/Haber-0.3.tar.gz -- __(

Re: qforeign-0.65: Bzip2: decompress hangs if data ends prematurely

2001-10-25 Thread Marcin 'Qrczak' Kowalczyk
Thu, 25 Oct 2001 12:06:53 +0200 (CEST), Michael Marte [EMAIL PROTECTED] pisze: I found that decompress hangs if data ends prematurely, i.e. do content - readFile fp doSomething (Bzip2.decompress content) does not terminate in this case. Try this patch (sorry,

Re: 5.02 MonadError Broke My Code

2001-10-24 Thread Marcin 'Qrczak' Kowalczyk
Sun, 21 Oct 2001 19:38:55 -0700, Ashley Yakeley [EMAIL PROTECTED] pisze: MonadError seems to have been redefined in 5.02 to have a fundep: 5.00.2: class (Monad m) = MonadError e m 5.02: class (Monad m) = MonadError e m | m - e Why? It allows some practical functions

Re: Multi-parameter OOP

2001-10-19 Thread Marcin 'Qrczak' Kowalczyk
Fri, 19 Oct 2001 17:02:54 +0200, George Russell [EMAIL PROTECTED] pisze: So is there any other way of doing this sort of dynamic lookup at runtime, in a reasonably neat way? There is module Dynamic. I don't know if it helps or is reasonably neat. -- __( Marcin Kowalczyk * [EMAIL

Re: catchAllIO

2001-10-13 Thread Marcin 'Qrczak' Kowalczyk
12 Oct 2001 12:15:16 Z, Steinitz, Dominic J [EMAIL PROTECTED] pisze: Can anyone help? catchAllIO seems to live in Exception but I can't find it in the documentation 4.12. Exception. It's deprecated, replaced by Exception.catch. -- __( Marcin Kowalczyk * [EMAIL PROTECTED]

Re: scope in ghci

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk
Fri, 05 Oct 2001 15:14:15 +0400, S.D.Mechveliani [EMAIL PROTECTED] pisze: Dm1 sort $ dm1 [1%2,1%3]-- contrived example is impossible. Instead, it needs Dm1 List.sort Prelude.$ dm1 [1 Ratio.% 2, 1 Ratio.% 3] This happens when the module Dm1 is compiled.

Re: UniCode

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk
Fri, 5 Oct 2001 23:23:50 +1000, Andrew J Bromage [EMAIL PROTECTED] pisze: There is a set of one million (more correctly, 1M) Unicode characters which are only accessible using surrogate pairs (i.e. two UTF-16 codes). There are currently none of these codes assigned, This information is out

Re: UniCode

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk
05 Oct 2001 14:35:17 +0200, Ketil Malde [EMAIL PROTECTED] pisze: Does Haskell's support of Unicode mean UTF-32, or full UCS-4? It's not decided officially. GHC uses UTF-32. It's expected that UCS-4 will vanish and ISO-10646 will be reduced to the same range U+..10 as Unicode. -- __(

Re: enormous executable

2001-10-02 Thread Marcin 'Qrczak' Kowalczyk
Mon, 1 Oct 2001 09:55:11 +0100, Simon Marlow [EMAIL PROTECTED] pisze: We don't have support for shared libraries under Unix at the moment. It has been investigated at various times in the past, and I believe the story is that we couldn't do it without at least losing some performance (more

Re: Ptr and ForeignPtr Questions

2001-09-23 Thread Marcin 'Qrczak' Kowalczyk
Sun, 23 Sep 2001 02:04:49 -0700, Ashley Yakeley [EMAIL PROTECTED] pisze: I would assume that Ptr types would always be mapped to non-const pointers. It would be impossible then to directly call a C function with a parameter declared as a const pointer. It's illegal in C to have mismatching

Re: Ptr and ForeignPtr Questions

2001-09-23 Thread Marcin 'Qrczak' Kowalczyk
Sun, 23 Sep 2001 15:41:41 -0700, Ashley Yakeley [EMAIL PROTECTED] pisze: But do you have an example of a Haskell type for a foreign import function, for which the corresponding C function type would be ambiguous? Ptr CChar (as an argument). It could be either char * or const char *. --

Re: Converting [Word8] to CString

2001-09-15 Thread Marcin 'Qrczak' Kowalczyk
Fri, 14 Sep 2001 23:40:42 -0700, Ashley Yakeley [EMAIL PROTECTED] pisze: I'm looking for a function that will convert a [Word8] byte-array to a CString (i.e. a C byte array) for the purposes of FFI. You can use newArray which allocates the C byte array using malloc so it must be freed by

Re: A question about Unicode support

2001-09-11 Thread Marcin 'Qrczak' Kowalczyk
Tue, 11 Sep 2001 13:19:54 -0300 (GMT), Pablo Pedemonte [EMAIL PROTECTED] pisze: Ghc 5.00.2 provides (initial) Unicode support, so I thought the chr function would do. But it seems it still rejects Int values greater than 0xFF. It doesn't. -- __( Marcin Kowalczyk * [EMAIL PROTECTED]

Re: GHC FFI Return Type Bug

2001-09-10 Thread Marcin 'Qrczak' Kowalczyk
10 Sep 2001 13:20:33 -0600, Alastair David Reid [EMAIL PROTECTED] pisze: So GHC's Int/Word implementation is different from Hugs'? Hugs represents Word8 (say) by a 32 bit int but doesn't guarantee that the top 24 bits are all zero. GHC does similarly, except that it does guarantee that

--RTS

2001-08-08 Thread Marcin 'Qrczak' Kowalczyk
Currently --RTS option for a program compiled with ghc means that all the following arguments are passed to the program, even if they are +RTS and -RTS. IMHO -- should act like --RTS too. Imagine a utility like Unix ls written in Haskell. If someone invokes it ls -- $FILENAME he means that

Re: POLL: GC options

2001-08-07 Thread Marcin 'Qrczak' Kowalczyk
Mon, 06 Aug 2001 15:40:50 -0700, Thomas Hallgren [EMAIL PROTECTED] pisze: Regarding the maximum heap size, to avoid letting the heap grow too large, you could perhaps take into account the number of page faults that occur during garbage collection, or the ratio between CPU time and real

Re: help needed for adding isWHNF primop to 5.00.2

2001-07-31 Thread Marcin 'Qrczak' Kowalczyk
Tue, 31 Jul 2001 12:38:03 +0100, Simon Marlow [EMAIL PROTECTED] pisze: That's the way I'd go. You have to declare the primitive like this, BTW: isWHNF# :: a - (# State# RealWorld, Int# #) because the compiler doesn't know about the IO type and you can't return a Bool directly.

Re: wait(2)

2001-07-26 Thread Marcin 'Qrczak' Kowalczyk
Thu, 26 Jul 2001 16:44:57 +0200, George Russell [EMAIL PROTECTED] pisze: Is there a way in Glasgow Haskell to get a thread to wait on a child process in the same way as the Posix function wait(), and get the termination status of the child? There is no easy way: all Haskell's thread run in

Re: [GHC5] Creating Socket.PortNumber from Int?

2001-06-06 Thread Marcin 'Qrczak' Kowalczyk
Wed, 6 Jun 2001 10:17:34 +0100, Simon Marlow [EMAIL PROTECTED] pisze: Think of it this way: mkPortNumber has been renamed to fromIntegral, and now supports making port numbers from any integral type, not just Int. BTW, why PortNumber is not just Int? -- __( Marcin Kowalczyk * [EMAIL

Re: Problems finding modules with GHC 5

2001-06-04 Thread Marcin 'Qrczak' Kowalczyk
Mon, 04 Jun 2001 18:59:57 -0400, Leon Smith [EMAIL PROTECTED] pisze: Loading package std ... linking ... done. ghc-5.00.1: can't find module `MArray' ghci Main.hs -package lang -- __( Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA

Re: Poll: System.exitWith behaviour

2001-05-23 Thread Marcin 'Qrczak' Kowalczyk
Wed, 23 May 2001 16:50:42 +1000, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: I think, having the third point is good, because the Haskell report requires that Computation exitWith code terminates the program, returning code to the program's caller. Well, it says also that

Re: Poll: System.exitWith behaviour

2001-05-23 Thread Marcin 'Qrczak' Kowalczyk
Here is what I just read on comp.lang.python: | the docs I have say that a thread can stop ITSELF, by raising | SystemExit, or calling sys.exit(). -- __( Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTÊPCZA QRCZAK

Re: Poll: System.exitWith behaviour

2001-05-22 Thread Marcin 'Qrczak' Kowalczyk
Tue, 22 May 2001 15:43:45 +0100, Simon Marlow [EMAIL PROTECTED] pisze: - If this exception propogates to the top of the thread, then the main thread is also sent (ExitException code). This only happens for a standalone executable (ie. one which was started by

Re: Poll: System.exitWith behaviour

2001-05-22 Thread Marcin 'Qrczak' Kowalczyk
Tue, 22 May 2001 17:30:39 +0100, Simon Marlow [EMAIL PROTECTED] pisze: Well, we could do a proper job of extensible data types, which probably isn't hard but is certainly a fair amount of work. This would be IMHO the only right way, but I doubt that it's that simple. For example it would be

Re: MonadError and fundeps

2001-05-11 Thread Marcin 'Qrczak' Kowalczyk
:: (ParsingState s, MonadState s m) = m String -- Ambiguous without the fundep. input = gets stateInput -- Marcin 'Qrczak' Kowalczyk ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell

Re: MonadError and fundeps

2001-05-11 Thread Marcin 'Qrczak' Kowalczyk
case (a language extension which redesigns records). OCaml has a dual mechanism for the second (polymorphic variants). If my records succeed, I will try to cover variants too. -- Marcin 'Qrczak' Kowalczyk ___ Glasgow-haskell-users mailing list [EMAIL

MonadError and fundeps

2001-05-10 Thread Marcin 'Qrczak' Kowalczyk
MonadReader, MonadWriter and MonadState classes have fundeps from the monad type to the environment / output / state type (I added them a few months ago). MonadError doesn't. I thought that it's desirable to make a class with more than one exception type, such that for example each catchError

Re: GHC and the Lazy Functional State Threads Paper

2001-05-03 Thread Marcin 'Qrczak' Kowalczyk
Thu, 03 May 2001 00:02:01 +0200, Thomas Pasch [EMAIL PROTECTED] pisze: If the immutable array type used was particularly UArray, it would be more efficient to use the corresponding STUArray instead of freezeArr3:: (Ix i, MArray.MArray (MArray.STUArray s) e (ST s), IArray.IArray a e)

Re: GHC and the Lazy Functional State Threads Paper

2001-04-27 Thread Marcin 'Qrczak' Kowalczyk
Sat, 28 Apr 2001 00:13:48 +0200, Thomas Pasch [EMAIL PROTECTED] pisze: newArr = newSTArray readArr = readSTArray writeArr = writeSTArray -- Error: Ambiguous type variable(s) `ix' in the constraint `Ix ix' freezeArr = freezeSTArray Monomorphism restriction strikes again.

RE: :! ghc -c vs :c

2001-04-26 Thread Marcin 'Qrczak' Kowalczyk
, but I would prefer to forget them explicitly (not necessarily individually). These definitions cover other things with the same names, as if we were inside a 'do' block. -- Marcin 'Qrczak' Kowalczyk ___ Glasgow-haskell-users mailing list [EMAIL

Re: [ghci] Comparison with Hugs

2001-04-24 Thread Marcin 'Qrczak' Kowalczyk
Tue, 24 Apr 2001 16:19:21 +0200, Volker Stolz [EMAIL PROTECTED] pisze: ghci however will complain that main is missing and even won't keep the defined functions in scope. Is there anything I can do about that? Add 'module Foo where' at the top of the file (preferably with the module name

Re: An attempt at foldr/build fusion for zip

2001-04-23 Thread Marcin 'Qrczak' Kowalczyk
Sun, 22 Apr 2001 08:45:45 -0500, Matt Harden [EMAIL PROTECTED] pisze: I think I may have found a way to get zip friends to fuse with *both* of their input lists. I tried to put in PrelList, changed foldr2_both to use a local recursive function which doesn't pass k around which allows to

Re: how to implement timeouts for IO operations?

2001-04-23 Thread Marcin 'Qrczak' Kowalczyk
Mon, 23 Apr 2001 15:36:09 +0100, Simon Marlow [EMAIL PROTECTED] pisze: The correct way to implement timeout in GHC 5.00 is below. This should really be in a library somewhere. IMHO unique exceptions should be factored out and available in a standalone way. -- __( Marcin Kowalczyk *

Re: how to implement timeouts for IO operations?

2001-04-18 Thread Marcin 'Qrczak' Kowalczyk
Wed, 18 Apr 2001 14:52:12 +0200 (MET DST), Johannes Waldmann [EMAIL PROTECTED] pisze: it seems to work, but how do I turn off the "Fail: thread killed" messages? import Exception t - block $ forkIO $ catchJust asyncExceptions (unblock timer) (\_ - return ()) Perhaps the

Re: How to convert the type signature of a variable to a String?

2001-04-15 Thread Marcin 'Qrczak' Kowalczyk
Sun, 15 Apr 2001 14:20:01 +1000, Andrew J Bromage [EMAIL PROTECTED] pisze: We know that the most general type of `id' is "a-a". We assume there's a theoretical function: get_the_function_type_of :: a - String where a can be a function type. Now consider: f :: (String -

Re: How to convert the type signature of a variable to a String?

2001-04-14 Thread Marcin 'Qrczak' Kowalczyk
Mon, 9 Apr 2001 11:52:47 +0200, Pasch, Thomas (ACTGRO) [EMAIL PROTECTED] pisze: So the question is: Is is possible to write a function the gives back a String with the signature of the argument of that function? For example: 'function f' gives the String "a-a" No. Classes are not

IArray and MArray

2001-04-11 Thread Marcin 'Qrczak' Kowalczyk
the translation into individual methods. I would let operations in IArray and MArray work on Ints and change current methods to functions overloaded over the array and the index. -- Marcin 'Qrczak' Kowalczyk ___ Glasgow-haskell-users mailing list [EMAIL

Re: Replacing module Array by IArray

2001-04-04 Thread Marcin 'Qrczak' Kowalczyk
Wed, 28 Mar 2001 21:11:59 +0200, [EMAIL PROTECTED] [EMAIL PROTECTED] pisze: The module Array exports module Ix (Haskell 98 Library Report). The module IArray doesn't export Ix (jet?). Thanks, it will export it in ghc-5.00. I think a pack and unpack function to convert between IArray ix be

Re: function over Array and UArray possible?

2001-03-29 Thread Marcin 'Qrczak' Kowalczyk
Thu, 29 Mar 2001 19:48:25 +0200, [EMAIL PROTECTED] [EMAIL PROTECTED] pisze: Is it possible to give a context, so that a function can have a signature which combines foo:: (Ix i) = Array i a - Array i aand foo:: (Ix i) = UArray i a - Uarray i a ? Yes: foo ::

Re: trouble with ghc-4.08.2-1.i386.rpm

2001-03-09 Thread Marcin 'Qrczak' Kowalczyk
09 Mar 2001 15:50:42 +0900, Jens-Ulrik Petersen [EMAIL PROTECTED] pisze: (BTW are there plans to upgrade to gmp3, which seems to be standard now in the Linux world?) Any comments on this? The CVS version of ghc uses gmp3 for a long time. -- __(" Marcin Kowalczyk * [EMAIL PROTECTED]

Fail: thread killed

2001-03-06 Thread Marcin 'Qrczak' Kowalczyk
I think I have raised the issue some time ago, but don't remember why it hasn't been solved as I would like to. Currently a thread which is killed displays Fail: thread killed, e.g. in the following program: import Concurrent main:: IO () main = do t - forkIO (threadDelay 100)

RE: --add-package

2001-02-23 Thread Marcin 'Qrczak' Kowalczyk
one has to write 'make uninstall install'. -- Marcin 'Qrczak' Kowalczyk ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

--add-package

2001-02-22 Thread Marcin 'Qrczak' Kowalczyk
In practice installation script of an external package does --del-package before --add-package, because if it was installed before, --add-package would cause an error. Wouldn't be reasonable then to let --add-package overwrite any existing package of that name? There is no real safety, because

Re: ANN: C-Haskell 0.8.1

2001-02-19 Thread Marcin 'Qrczak' Kowalczyk
Mon, 19 Feb 2001 15:53:41 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: Strange - meanwhile, I have put release 0.10.4 out. Among other things, it finally has an `install' target. Thanks, everything compiles and mostly works. Examples still behave strangely: rngtest goes crazy when

Re: ANN: C-Haskell 0.8.1

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 18:42:08 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: Now, everything should be checked in. Seems OK, thanks. ghc411hack_dir does not work for me again: ghc -M in build/ghc4/chs/lib can't find NewStablePtr.hs (because there is only NewStablePtr.hs.in) and the

Re: ANN: C-Haskell 0.8.1

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
16 Feb 2001 09:21:51 GMT, Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] pisze: ghc411hack_dir does not work for me again: Ah, I see: haven't run autoconf in c2hs subdirectory. Now it will hopefully work. -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.n

Re: ANN: C-Haskell 0.8.1

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 18:42:08 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: PS: With the current Gtk+HS source in CVS, all Gtk+HS examples as well as the iHaskell library and its three examples should now all work again. I tested it all on my machine. gtk+hs under

Re: ANN: C-Haskell 0.8.1

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 18:42:08 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: PS: With the current Gtk+HS source in CVS, all Gtk+HS examples as well as the iHaskell library and its three examples should now all work again. They compile but they don't run correctly on ghc-4.11.

Re: ANN: C-Haskell 0.8.1

2001-02-15 Thread Marcin 'Qrczak' Kowalczyk
Thu, 15 Feb 2001 18:44:56 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: But the error in CInfo is still there. That's strange. Could you try this with either the release of 0.8.2 that I put up yesterday or with the CVS version again? Hmm, it works now. There are two files

Re: ANN: C-Haskell 0.8.1

2001-02-14 Thread Marcin 'Qrczak' Kowalczyk
12 Feb 2001 14:48:09 GMT, Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] pisze: It could be my fault: I ran ./configure before updating it with autoconf, and perhaps did not clean afterwards. Ok, it was my fault. But the error in CInfo is still there. And C2HS does not export most of cast*Ptr

Re: ANN: C-Haskell 0.8.1

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
Mon, 12 Feb 2001 14:07:01 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: This is very strange, because I have tested this and it worked for me. It could be my fault: I ran ./configure before updating it with autoconf, and perhaps did not clean afterwards. In fact, if you look at

Re: ANN: C-Haskell 0.8.1

2001-02-11 Thread Marcin 'Qrczak' Kowalczyk
11 Feb 2001 13:36:31 GMT, Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] pisze: A problem: [...] These problems apply to cvs' HEAD. -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ ^^ SYGNATURA ZASTPCZA Q

Re: GHC-4.08.2

2001-02-07 Thread Marcin 'Qrczak' Kowalczyk
Thu, 08 Feb 2001 17:09:19 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: This will only work if you install RPM 4, no? True. I didn't know whether the src.rpm format also changed. AFAIK it did not change. -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/

Re: Semi-applied datatypes in instance declarations

2001-02-06 Thread Marcin 'Qrczak' Kowalczyk
On Tue, 6 Feb 2001, George Russell wrote: I apologise if this has been raised before, but the code I am writing now would look rather nicer if "partially applied type constructors" were permitted in instances. They are. For example monads. -- Marcin 'Qrczak'

Re: Floating point performance

2001-01-29 Thread Marcin 'Qrczak' Kowalczyk
Mon, 29 Jan 2001 18:15:02 +0100, Jan Kort [EMAIL PROTECTED] pisze: I didn't use any optimizations, but I am sure that passing -O to ghc will make it see that 1*1*... is a constant expression. It does not, because it's n*1*1*1*... where n is not a constant. Major advantages seem to be from

Re: Floating point performance

2001-01-26 Thread Marcin 'Qrczak' Kowalczyk
Fri, 26 Jan 2001 17:40:17 +0100, Jan Kort [EMAIL PROTECTED] pisze: I made a profile and it says most of the time (93%) is spent in the function bar. Did you compile with optimization turned on (option -O)? I see similar results without -O but quite different with -O. -- __(" Marcin

_scc_

2001-01-25 Thread Marcin 'Qrczak' Kowalczyk
Why _scc_ "foo" and not {-# SCC "foo" #-} ? IMHO a pragma would be better: does not make the scc-annotated program non-standard. (Well, nhc98 should be fixed to ignore unknown pragmas in arbitrary places.) -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/

Re: Generic Classes?

2000-12-30 Thread Marcin 'Qrczak' Kowalczyk
Sat, 30 Dec 2000 09:02:55 -0800, Simon Peyton-Jones [EMAIL PROTECTED] pisze: They'll be in our first release of GHCi. What about my old comments about distinguishing "the rest of constructors" from "contents of the constructor we found", and "the rest of fields" from "contents of the field we

Re: Transitive inlining

2000-12-11 Thread Marcin 'Qrczak' Kowalczyk
Tue, 12 Dec 2000 00:41:01 +1100, Manuel M. T. Chakravarty [EMAIL PROTECTED] pisze: PS: I had problems building GHCi and it seems as if my message to [EMAIL PROTECTED] doesn't get through somehow... Subject: "mail boot" problem ? I have got it. -- __(" Marcin Kowalczyk * [EMAIL

Re: Fun with GHC's optimiser

2000-12-07 Thread Marcin 'Qrczak' Kowalczyk
Thu, 7 Dec 2000 09:17:44 -0800, Simon Peyton-Jones [EMAIL PROTECTED] pisze: Try now. On the HEAD. Which should compile OK now, incidentally. But does not work... ../../ghc/compiler/ghc-inplace -recomp -cpp -fglasgow-exts -fvia-C -icheck -O -package lang -package concurrent -package

Re: Or-patterns

2000-12-06 Thread Marcin 'Qrczak' Kowalczyk
Mon, 04 Dec 2000 17:17:42 +0100, George Russell [EMAIL PROTECTED] pisze: Where you have variables in the patterns, you bind only the variables which appear in all the patterns, and you unify the types accordingly. Or bind them all (otherwise there would be _ written) and get bottom in case

Re: Instant readFile

2000-11-16 Thread Marcin 'Qrczak' Kowalczyk
Wed, 15 Nov 2000 18:42:29 +0100, George Russell [EMAIL PROTECTED] pisze: What I want instead is a function which (a) opens the file; (b) slurps the complete contents compactly into an array; (c) closes the file; (d) makes the contents of the array available as a String.

Re: Help me to correct this code, please ! :-)

2000-10-03 Thread Marcin 'Qrczak' Kowalczyk
Fri, 29 Sep 2000 12:26:42 -0300, [EMAIL PROTECTED] [EMAIL PROTECTED] pisze: instance Ix ix = Foo (MutableByteArray s ix) where foo x = runST(unsafeFreezeByteArray x) Mutable objects in the ST world, parametrized by those s type variables, must be created and used "locally" in an

My mistake is harder to diagnose than it could be

2000-08-18 Thread Marcin 'Qrczak' Kowalczyk
I've just done the same mistake a third time: took a module A, moved part of it to a new module B, imported A from B, but forgot to change the module header in B which still said "module A". The GHC's answer to that when compiling B.hs is that the module A does not export a bunch of things (if

Re: The type of zip

2000-07-28 Thread Marcin 'Qrczak' Kowalczyk
Fri, 28 Jul 2000 08:23:52 -0700, Simon Marlow [EMAIL PROTECTED] pisze: It perhaps should be, but Int8 isn't a primitive type: it's implemented in terms of Int#. There should really be 8-bit, 16-bit and 32-bit primitive types in GHC It's not a problem: writeInt8OffAddr could take Int#. I

Re: GHC Renamer

2000-07-17 Thread Marcin 'Qrczak' Kowalczyk
Mon, 17 Jul 2000 15:38:45 -0500, Kate S. Golder [EMAIL PROTECTED] pisze: Are these declarations simply added to all files? They are values referenced in RULES pragmas in Prelude modules. In particular what are "PrelBase.zi" and "PrelBase.zaza"? Look at ghc/compiler/basicTypes/OccName.lhs

Re: Glob functionality in GHC/Haskell

2000-07-11 Thread Marcin 'Qrczak' Kowalczyk
Mon, 10 Jul 2000 19:11:35 -0400, Alexander Williams [EMAIL PROTECTED] pisze: /tmp/ghc10834_stb.h:2: parse error before `Examples_d6q9' /tmp/ghc10834_stb.h:2: warning: type defaults to `int' in declaration of `Examples_d6q9' /tmp/ghc10834_stb.h:2: warning: data definition has no type or

Re: perl frontend for ghc

2000-06-28 Thread Marcin 'Qrczak' Kowalczyk
Wed, 28 Jun 2000 02:36:04 -0700, Simon Marlow [EMAIL PROTECTED] pisze: But fortunately now we have, and if you look at the current CVS HEAD you'll see the new driver, written (almost) entirely in Haskell. Written in Haskell when we consider a compiler which is needed to compile it, but it's

Method contexts

2000-06-27 Thread Marcin 'Qrczak' Kowalczyk
The restriction that a method context must constrain at least one type variable that is quantified there has biten me: class Member c a | c - a where member :: Eq a = c - a - Bool class Member (s a) a = Sequence s a where single :: a - s a instance Member [a] a where member s a = elem a s

Re: Can't catch exception in socket communication

2000-06-21 Thread Marcin 'Qrczak' Kowalczyk
Wed, 21 Jun 2000 02:00:09 -0700, Simon Marlow [EMAIL PROTECTED] pisze: installHandler sigPIPE Ignore Nothing That seems to be enough. That's it. This one caught me too! But it's standard behaviour, so I think we should leave it in place. Adding a note in the documentation. --

Re: GHC Version numbers (was: RE: 4.07 release candidate snapshot ava ilable)

2000-06-20 Thread Marcin 'Qrczak' Kowalczyk
Mon, 19 Jun 2000 20:59:07 -0500, Matt Harden [EMAIL PROTECTED] pisze: Numbers ending in ".0" are counterintuitive to me. So start with ".1" :-) As Linux kernel. (I see nothing wrong with ".0".) -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/GCS/M

Re: Dynamic and persistent data storage

2000-06-12 Thread Marcin 'Qrczak' Kowalczyk
Mon, 12 Jun 2000 20:42:16 +1000 (EST), [EMAIL PROTECTED] [EMAIL PROTECTED] pisze: To do this would require several things the current Dynamic library lacks: [...] I think it's much harder. How would you store and restore actual data? It depends on its real type, and for many types it's

Re: Posix.FileStatus: st_rdev from struct stat is missing

2000-06-12 Thread Marcin 'Qrczak' Kowalczyk
Mon, 12 Jun 2000 09:36:33 -0700, Sigbjorn Finne [EMAIL PROTECTED] pisze: None of these are POSIX supported (same with st_blksize.) Ah. Sorry if I asked this before, but I could not find the answer now: are POSIX specifications freely available somewhere? It would be nice to have module(s)

Posix.FileStatus: st_rdev from struct stat is missing

2000-06-11 Thread Marcin 'Qrczak' Kowalczyk
The subject says all. -- __("Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ GCS/M d- s+:-- a23 C+++$ UL++$ P+++ L++$ E- ^^ W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t QRCZAK 5? X- R tv-- b+++ DI D- G+

Re: Signals

2000-06-09 Thread Marcin 'Qrczak' Kowalczyk
Thu, 8 Jun 2000 18:26:27 -0700, William Lee Irwin III [EMAIL PROTECTED] pisze: Is there a curses library in the works? Yes, inside http://qrczak.ids.net.pl/Haber-0.2.tar.gz (requires ghc-4.07). -- __("Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/

Signals

2000-06-08 Thread Marcin 'Qrczak' Kowalczyk
I want to clean up (close curses) on termination on signals. Is there a way of doing this for all relevant signals at once, or I should install separate handlers for each? Is there a better way of executing the old handler than the following? fixIO $ \old - installHandler

RULES for conversions of CTypes

2000-05-26 Thread Marcin 'Qrczak' Kowalczyk
Fortunately it's not needed to make N^2 rules for N types! {-# RULES "fromIntegral/a-CShort" fromIntegral = \x - CShort (fromIntegral x) "fromIntegral/a-CUShort" fromIntegral = \x - CUShort (fromIntegral x) "fromIntegral/a-CInt"fromIntegral = \x - CInt(fromIntegral x)

Re: Unicode

2000-05-16 Thread Marcin 'Qrczak' Kowalczyk
Tue, 16 May 2000 10:44:28 +0200, George Russell [EMAIL PROTECTED] pisze: As for the language standard: I hope that Char will be allowed or required to have =30 bits instead of current 16; but never more than Int, to be able to use ord and chr safely. Er does it have to? The Java

Re: Unicode

2000-05-16 Thread Marcin 'Qrczak' Kowalczyk
Tue, 16 May 2000 12:26:12 +0200 (MET DST), Frank Atanassow [EMAIL PROTECTED] pisze: Of course, you can always come up with specialized schemes involving stateful encodings and/or "block-swapping" (using the Unicode private-use areas, for example), but then, that subverts the purpose of

Unicode

2000-05-13 Thread Marcin 'Qrczak' Kowalczyk
How safe is representinging Unicode characters as Chars unsafeCoerce#d from large Ints? Seems to work in simple cases :-) -- __("Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ GCS/M d- s+:-- a23 C+++$ UL++$ P+++ L++$ E- ^^ W++

Warnings about unused modules

2000-05-13 Thread Marcin 'Qrczak' Kowalczyk
GHC -Wall warns about unused entities that were explicitly imported, but does not warn about unused "import SomeModule". Maybe it should... -- __("Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ GCS/M d- s+:-- a23 C+++$ UL++$ P+++ L++$ E- ^^

RE: Converting float to double.

2000-05-10 Thread Marcin 'Qrczak' Kowalczyk
loat-Double function can be used instead of going through Rational. AFAIR integral types do have {-#RULES#-} for conversions between each pair of them, including Int16/Word64/etc. I'm not sure about Int-Double etc. (both fromIntegral and realToFrac can be used here!). -- Marcin 'Qrczak' Kowalczyk

Re: Converting float to double.

2000-05-10 Thread Marcin 'Qrczak' Kowalczyk
Wed, 10 May 2000 13:49:30 +0200 (CEST), Lennart Augustsson [EMAIL PROTECTED] pisze: (BTW, hbc has optimized these conversion since about 6 years ago.) How? RULES similar to ghc? Or built-in compiler magic for this case? -- __("Marcin Kowalczyk * [EMAIL PROTECTED]

Completely abstract types

2000-04-24 Thread Marcin 'Qrczak' Kowalczyk
What should be the preferred way of declaring completely abstract types, without any meaningful representation known anywhere, for use as a tag only (of the Ptr type from some new Foreign library)? 1. data CFile = CFile GHC -Wall warns that I don't use the data constructor anywhere. Right,

Re: putMVar on full MVar

2000-04-12 Thread Marcin 'Qrczak' Kowalczyk
Wed, 12 Apr 2000 15:12:31 +0100, Claus Reinke [EMAIL PROTECTED] pisze: PS. As for tryTakeMVar or locks on MVars, what is wrong with using MMVar a = (MVar (MayBe a)) and a suitable access protocol? MVar empty-- MMVar is locked MVar Nothing -- MMVar is empty,

Re: tryTakeMVar :: MVar a - IO (Maybe a)

2000-04-10 Thread Marcin 'Qrczak' Kowalczyk
Sun, 9 Apr 2000 13:54:47 -0700, Sigbjorn Finne [EMAIL PROTECTED] pisze: Wouldn't be nice to have such function? Have you tried using Concurrent.isEmptyMVar ? isEmptyMVar is not enough to implement tryTakeMVar (but tryTakeMVar would suffice for isEmptyMVar). Just after checking that it is

tryTakeMVar :: MVar a - IO (Maybe a)

2000-04-08 Thread Marcin 'Qrczak' Kowalczyk
Wouldn't be nice to have such function? I wanted to translate a thread example written in Ruby and realized that it's impossible to write that function using MVar primitives provided; and no module seems to provide an equivalent using another kind of concurrent variable. I had to simulate

Re: Debugging techniques

2000-04-06 Thread Marcin 'Qrczak' Kowalczyk
Thu, 6 Apr 2000 12:15:26 -0700, Michael A. Jones [EMAIL PROTECTED] pisze: Second, perhaps you can suggest a place I can ask newbie questions that is more appropriate than this list. IMHO this is good. For questions not related to GHC there is a parallel haskell mailing list, and there is a

Re: lex 1x23 == [(123,)] reads 1x23 == [(123,)]

2000-03-14 Thread Marcin 'Qrczak' Kowalczyk
Tue, 14 Mar 2000 01:28:47 -0800, Simon Marlow [EMAIL PROTECTED] pisze: I'm incorporating Daan Leijen's Parsec library (a complete, fast, and well-documented parsing combinator library, see http://www.cs.uu.nl/~daan/parsec.html) into hslibs. Great! I haven't seen it before. Oops, what about

Re: lex 1x23 == [(123,)] reads 1x23 == [(123,)]

2000-03-13 Thread Marcin 'Qrczak' Kowalczyk
Mon, 13 Mar 2000 03:34:28 -0800, Simon Marlow [EMAIL PROTECTED] pisze: Thanks, this is now fixed (well partially, we don't attempt to lex hexadecimal literals any more). Good, I actually wanted to parse WIDTHxHEIGHT :-) Generally I don't understand why some languages provide libraries for

STArray and MutableArray

2000-03-12 Thread Marcin 'Qrczak' Kowalczyk
Why are there separate STArray and MutableArray types, as their representation is the same? -- __("Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/ \__/ GCS/M d- s+:-- a22 C+++$ UL++$ P+++ L++$ E- ^^ W++ N+++ o? K? w(---) O? M- V? PS--

Qualified names in foreign export

2000-03-07 Thread Marcin 'Qrczak' Kowalczyk
Shouldn't foreign exported names be allowed to be qualified? I've just accidentally reused a Prelude name for a function to be foreign exported and could not resolve the conflict with the first way that came to mind: qualifying. It's only not obvious what C name would it get by default.

  1   2   >