Re: [Haskell-cafe] Looking for these libraries...

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
John Goerzen [EMAIL PROTECTED] writes: I'm looking for libraries / interfaces to these systems from Haskell: LDAP ncurses zlib (the one in darcs doesn't suit my needs) bz2lib I once wrapped ncurses (incomplete), zlib and bz2lib. http://sourceforge.net/projects/qforeign/ It's quite old

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
Robert Dockins [EMAIL PROTECTED] writes: More than you would think, if you follow the conventions of modern unix shells. eg, foo/.. is always equal to ., For the OS it's not the same if foo is a non-local symlink. Shells tend to resolve symlinks themselves on cd, and cd .. means to remove the

Re: [Haskell-cafe] File path programme

2005-01-27 Thread Marcin 'Qrczak' Kowalczyk
John Meacham [EMAIL PROTECTED] writes: too bad we can't do things like #if exists(module System.Path) import System.Path #else ... #endif I still find it perplexing that there isn't a decent standard haskell preprocessor For my language Kogut I designed a syntax ifDefined

Re: [Haskell-cafe] Re: mathematical notation and functional programming

2005-01-29 Thread Marcin 'Qrczak' Kowalczyk
Stefan Monnier [EMAIL PROTECTED] writes: OTOH I like the abc shorthand because it's both obvious and unambiguous (as long as the return value of can't be passed as an argument to , which is typically the case when the return value is boolean and there's no ordering defined on booleans).

Re: [Haskell-cafe] Re: File path programme

2005-01-30 Thread Marcin 'Qrczak' Kowalczyk
Stefan Monnier [EMAIL PROTECTED] writes: The various UTF encodings do not have this particular problem; if a UTF string is valid, then it is a unique representation of a unicode string. However, decoding is still a partial function and can fail. And while it is partly true, it is qualified

Re: [Haskell-cafe] File path programme

2005-01-30 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: Then of course there's the issue that Win32 edge labels are Unicode, while Posix edge labels are [Word8]. Hmm. Strictly speaking, they're [CChar], but I doubt that anyone will ever implement Haskell on a platform where a byte isn't 8 bits wide. On

Re: [Haskell-cafe] File path programme

2005-01-30 Thread Marcin 'Qrczak' Kowalczyk
David Roundy [EMAIL PROTECTED] writes: No, it's not Unix-specific, it's portable. If you want to write portable C code, you have to use the standard library, which means that file names are represented as Ptr CChar. I disagree. We are talking about portable Haskell, not portable C. The

Re: [Haskell-cafe] File path programme

2005-01-30 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: And it isn't a theoretical issue. E.g. in an environment where EUC-JP is used, filenames may begin with ESC$)B (designate JISX0208 to G1), or they may not (because G1 is assumed to contain JISX0208 initally). I think such encodings are never used as

Re: [Haskell-cafe] Re: File path programme

2005-01-30 Thread Marcin 'Qrczak' Kowalczyk
Aaron Denney [EMAIL PROTECTED] writes: Better yet would be to have the standard never allow the BOM. If I could decide, I would ban the BOM in UTF-8 altogetger, but I'm afraid the Unicode Consortium doesn't want to do this. Miscosoft Notepad puts a BOM in UTF-8 encoded files. -- __(

[Haskell-cafe] Re: UTF-8 BOM, really!?

2005-01-31 Thread Marcin 'Qrczak' Kowalczyk
Graham Klyne [EMAIL PROTECTED] writes: How can it make sense to have a BOM in UTF-8? UTF-8 is a sequence of octets (bytes); what ordering is there here that can sensibly be varied? The *name* BOM doesn't make sense when applied to UTF-8, but some software uses UTF-8 encoded U+FEFF it as a

Re: [Haskell-cafe] Re: File path programme

2005-01-31 Thread Marcin 'Qrczak' Kowalczyk
Peter Simons [EMAIL PROTECTED] writes: http://cryp.to/pathspec/PathSpec.hs There also is a function which changes a path specification into its canonic form, meaning that all redundant segments are stripped. It's incorrect: canon (read x/y/.. :: RelPath Posix) gives x, yet on Unix they

Re: [Haskell-cafe] The Nature of Char and String

2005-02-02 Thread Marcin 'Qrczak' Kowalczyk
Ketil Malde [EMAIL PROTECTED] writes: The Haskell functions accept or return Strings but interface to OS functions which (at least on Unix) deal with arrays of bytes (char*), and the encoding issues are essentially ignored. If you pass strings containing anything other than ISO-8859-1, you

Re: [Haskell-cafe] What is MonadPlus good for?

2005-02-14 Thread Marcin 'Qrczak' Kowalczyk
Josef Svenningsson [EMAIL PROTECTED] writes: You claimed that monad transformers break the mzero-is-right-identity-for-bind law because they can be applied to IO. I say, it's not the monad transformers fault. They cannot possibly be expected to repair the law if they are given a faulty monad.

[Haskell-cafe] Bound threads

2005-02-25 Thread Marcin 'Qrczak' Kowalczyk
I'm trying to understand the semantics and implementation of bound threads basing on the conc-ffi paper and others. Since the main thread is bound, and unbound threads are never executed on an OS thread which has some Haskell thread bound, this would imply that when the main thread spawns a

Re: [Haskell-cafe] Re: Bound threads

2005-02-26 Thread Marcin 'Qrczak' Kowalczyk
Wolfgang Thaller [EMAIL PROTECTED] writes: Since the main thread is bound, and unbound threads are never executed on an OS thread which has some Haskell thread bound, this would imply that when the main thread spawns a Haskell thread and they synchronize a lot with each other using MVars, the

Re: [Haskell-cafe] Re: Bound threads

2005-02-28 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: Is it important which thread executes Haskell code (I bet no) and unsafe foreign calls (I don't know)? If not, couldn't the same OS thread execute code of both threads until a safe foreign call is made? Actually in a bound thread, *all* foreign calls

Re: [Haskell-cafe] Re: Bound threads

2005-03-01 Thread Marcin 'Qrczak' Kowalczyk
Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] writes: Why is the main thread bound? I can answer myself: if the main thread is unbound, the end of the program can be reached in a different OS thread, which may be a problem if we want to return cleanly to the calling code. I've now implemented

Re: [Haskell-cafe] Re: Bound threads

2005-03-01 Thread Marcin 'Qrczak' Kowalczyk
Benjamin Franksen [EMAIL PROTECTED] writes: Producer/consumer ping-pong is 15 times slower between threads running on different OS threads than on two unbound threads. Which OS? Linux/NPTL. A context switch which changes OS threads involves: setitimer pthread_sigmask

Re: [Haskell-cafe] Re: Bound threads

2005-03-02 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: I've now implemented a threaded runtime in my language Kogut, based on the design of Haskell. The main thread is bound. The thread which holds the capability performs I/O multiplexing itself, without a separate service thread. We found that doing this

Re: [Haskell-cafe] Re: Bound threads

2005-03-03 Thread Marcin 'Qrczak' Kowalczyk
Wolfgang Thaller [EMAIL PROTECTED] writes: Indeed, my brain is melting, but I did it :-) Congratulations. How about we found a Bound-thread-induced brain melt victims' support group? The melt was entertaining :-) Besides simplicity, one of the main reasons for moving our select() call

Re: [Haskell-cafe] invalid character encoding

2005-03-16 Thread Marcin 'Qrczak' Kowalczyk
Duncan Coutts [EMAIL PROTECTED] writes: It doesn't affect functions added by the hierarchical libraries, i.e. those functions are safe only with the ASCII subset. (There is a vague plan to make Foreign.C.String conform to the FFI spec, which mandates locale-based encoding, and thus would

Re: [Haskell-cafe] invalid character encoding

2005-03-16 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: It should be possible to specify the encoding explicitly. Conversely, it shouldn't be possible to avoid specifying the encoding explicitly. What encoding should a binding to readline or curses use? Curses in C comes in two flavors: the traditional

Re: [Haskell-cafe] invalid character encoding

2005-03-16 Thread Marcin 'Qrczak' Kowalczyk
John Meacham [EMAIL PROTECTED] writes: In any case, we need tools to be able to conform to the common cases of ascii-only (withCAStrirg) and current locale (withCString). withUTF8String would be a nice addition, but is much less important to come standard as it can easily be written by end

Re: [Haskell-cafe] invalid character encoding

2005-03-17 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: The (non-wchar) curses API functions take byte strings (char*), so the Haskell bindings should take CString or [Word8] arguments. Programmers will not want to use such interface. When they want to display a string, it will be in Haskell String type.

Re: [Haskell-cafe] invalid character encoding

2005-03-17 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: E.g. Gtk-2.x uses UTF-8 almost exclusively, although you can force the use of the locale's encoding for filenames (if you have filenames in multiple encodings, you lose; filenames using the wrong encoding simply don't appear in file selectors).

Re: [Haskell-cafe] invalid character encoding

2005-03-18 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: If you provide wrapper functions which take String arguments, either they should have an encoding argument or the encoding should be a mutable per-terminal setting. There is already a mutable setting. It's called locale. It isn't a per-terminal

Re: [Haskell-cafe] invalid character encoding

2005-03-19 Thread Marcin 'Qrczak' Kowalczyk
Wolfgang Thaller [EMAIL PROTECTED] writes: Also, IIRC, Java strings are supposed to be unicode, too - how do they deal with the problem? Java (Sun) -- Filenames are assumed to be in the locale encoding. a) Interpreting. Bytes which cannot be converted are replaced by U+FFFD. b)

Re: [Haskell-cafe] Instances of constrained datatypes

2005-04-06 Thread Marcin 'Qrczak' Kowalczyk
Arjun Guha [EMAIL PROTECTED] writes: data (Eq v) = EqList v = EqList [v] I'd like to make it an instance of Functor. However, fmap takes an arbitrary function of type a - b. I need an Eq constraint on a and b. Is there any way to do this without creating my own `EqFunctor' class with

Re: [Haskell-cafe] Re: Haskell vs OCaml

2005-05-03 Thread Marcin 'Qrczak' Kowalczyk
John Goerzen [EMAIL PROTECTED] writes: I'd say that there are probably no features OCaml has that Haskell lacks that are worth mentioning. Its type system has some interesting features: polymorphic variants, parametric modules, labeled and optional arguments, objects, variance annotations of

Re: [Haskell-cafe] Re: Haskell vs OCaml

2005-05-03 Thread Marcin 'Qrczak' Kowalczyk
Michael Vanier [EMAIL PROTECTED] writes: I also learned ocaml before learning haskell, and the biggest single difference I found is that haskell is a lazy, purely functional language and ocaml is a strict, mostly functional language. Indeed. In contrast to this one, my differences were not

Re: [Haskell-cafe] Re: Haskell vs OCaml

2005-05-04 Thread Marcin 'Qrczak' Kowalczyk
Donn Cave [EMAIL PROTECTED] writes: I have been able to build ocaml everywhere I have wanted it, including the native code compiler. And it builds itself much faster than GHC. (I couldn't measure how much, because GHC didn't build at all, failing to find HsBaseConfig.h.in.) -- __(

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Marcin 'Qrczak' Kowalczyk
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

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Marcin 'Qrczak' Kowalczyk
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

Re: [Haskell-cafe] Compiling with NHC98

2005-05-07 Thread Marcin 'Qrczak' Kowalczyk
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.

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Marcin 'Qrczak' Kowalczyk
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

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Marcin 'Qrczak' Kowalczyk
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

Re: [Haskell-cafe] Specify array or list size?

2005-05-07 Thread Marcin 'Qrczak' Kowalczyk
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,

Re: [Haskell-cafe] Space questions about intern and sets

2005-06-01 Thread Marcin 'Qrczak' Kowalczyk
Gracjan Polak [EMAIL PROTECTED] writes: intern :: Ord a = a - a intern x = unsafePerformIO $ internIO x iorefset :: Ord a = IORef(Map.Map a a) iorefset = unsafePerformIO $ do newIORef $ Map.empty It will not work because you can't put values of different types as keys of the same

Re: [Haskell-cafe] Why is $ right associative instead of leftassociative?

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Brian Hulley [EMAIL PROTECTED] writes: My final suggestion if anyone is interested is as follows: 1) Use : for types 2) Use , instead of ; in the block syntax so that all brace blocks can be replaced by layout if desired (including record blocks) 3) Use ; for list cons. ; is already used

Re: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin [EMAIL PROTECTED] writes: i reported only the speed of the buffering transformers. this don't include speed of char encoding that should be very low at this time. Recoding will be slow if it's done on top of buffering and if encoding itself has heavy startup. Buffering should

Re: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin [EMAIL PROTECTED] writes: MQK It should be possible to use iconv for recoding. Iconv works on MQK blocks and it should not be applied to one character at a time. recoding don't need any startup. Calling iconv (or other similar routine) does need startup. And you really don't

Re: [Haskell-cafe] Re[2]: Streams: the extensible I/O library

2006-02-12 Thread Marcin 'Qrczak' Kowalczyk
Bulat Ziganshin [EMAIL PROTECTED] writes: recoding don't need any startup. each vGetChar or vPutChar just executes one or more vGetByte/vPutByte calls, according to encoding rules. this should be fast enough Hmm, your interface for the encoder (String - [Word8]) doesn't support stateful

Re: [Haskell-cafe] Re: standard poll/select interface

2006-02-23 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: I think the reason we set O_NONBLOCK is so that we don't have to test with select() before reading, we can just call read(). If you don't use O_NONBLOCK, you need two system calls to read/write instead of one. This probably isn't a big deal, given that

Re: [Haskell-cafe] Re: standard poll/select interface

2006-02-23 Thread Marcin 'Qrczak' Kowalczyk
Simon Marlow [EMAIL PROTECTED] writes: I agree that a generic select/poll interface would be nice. We must be aware that epoll (and I think kqueue too) registers event sources in advance, separately from waiting, which is its primary advantage over poll. The interface should use this model

Re: Num class

2000-10-19 Thread Marcin 'Qrczak' Kowalczyk
as Double (the answer may depend on the implementation). -- Marcin 'Qrczak' Kowalczyk ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: {-# LINE 100 Foo.hs #-} vs. # 100 Foo.hs

2001-01-19 Thread Marcin 'Qrczak' Kowalczyk
Wed, 17 Jan 2001 02:39:53 -0800, Simon Marlow [EMAIL PROTECTED] pisze: Actually the cpp-style pragma is only recognised if the '#' is in the leftmost column and is followed by optional spaces and a digit. It's quite hard to write one of these in a legal Haskell program, but not impossible.

Re: O'Haskell OOP Polymorphic Functions

2001-01-30 Thread Marcin 'Qrczak' Kowalczyk
Tue, 30 Jan 2001 00:13:41 -0800, Ashley Yakeley [EMAIL PROTECTED] pisze: How do I define downcast? You can use a non-standard module Dynamic present in ghc, hbc and Hugs (I don't know if it's compatible with O'Haskell). -- __(" Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/

Re: Revamping the numeric classes

2001-02-07 Thread Marcin 'Qrczak' Kowalczyk
07 Feb 2001 11:47:11 +0100, Ketil Malde [EMAIL PROTECTED] pisze: If it is useful to have a fine granularity of classes, you can imagine doing: class Multiplicative a b c where (*) :: a - b - c Then a*b*c is ambiguous no matter what are types of a,b,c and the

Re: Revamping the numeric classes

2001-02-08 Thread Marcin 'Qrczak' Kowalczyk
or h? Note that Int-Double is not a subtype of Int-Int, so if h :: (Int-Int)-Bool, then I can't imagine how h can be applied to something :: Int-Double. -- Marcin 'Qrczak' Kowalczyk ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.o

Re: Show, Eq not necessary for Num [Was: Revamping the numeric c

2001-02-08 Thread Marcin 'Qrczak' Kowalczyk
Thu, 08 Feb 2001 15:11:21 +0100 (CET), Elke Kasimir [EMAIL PROTECTED] pisze: However, what is missing for me is something like: type Comfortable a = (Show a, Eq a, Num a) = a or class (Show a, Read a, Eq a) = Comfortable a instance (Show a, Read a, Eq a) = Comfortable a I agree and

Re: Revamping the numeric classes

2001-02-08 Thread Marcin 'Qrczak' Kowalczyk
Thu, 8 Feb 2001 10:51:58 -0500, Peter Douglass [EMAIL PROTECTED] pisze: The first part of my question (not contained in your reply) is whether it is feasible to disable a developer's access to the "unsafe" numerical operations. import Prelude hiding (quot, rem, (/) {- etc. -}) import

Re: Revamping the numeric classes

2001-02-08 Thread Marcin 'Qrczak' Kowalczyk
Thu, 8 Feb 2001 21:41:56 +1100, Fergus Henderson [EMAIL PROTECTED] pisze: Should this define an instance for `foo T'? (I think not.) How about if the instance declaration is changed to instance bar T where f = 41 -- no definition for f2

Re: Revamping the numeric classes

2001-02-08 Thread Marcin 'Qrczak' Kowalczyk
Thu, 08 Feb 2001 11:24:49 +, Jerzy Karczmarczuk [EMAIL PROTECTED] pisze: The implicit coercion of numeric constants: 3.14 -=- (fromDouble 3.14) etc. is sick. What do you propose instead? (BTW, it's fromRational, to keep arbitrarily large precision.) Now, signum and abs seem to be

Re: Show, Eq not necessary for Num [Was: Revamping the numeric c

2001-02-09 Thread Marcin 'Qrczak' Kowalczyk
Fri, 9 Feb 2001 11:48:33 -0500, Dylan Thurston [EMAIL PROTECTED] pisze: class (Show a, Read a, Eq a) = Comfortable a instance (Show a, Read a, Eq a) = Comfortable a Why isn't it legal? Because in Haskell 98 instance's head must be of the form of a type constructor applied to type

Re: Show, Eq not necessary for Num [Was: Revamping the numeric classes]

2001-02-09 Thread Marcin 'Qrczak' Kowalczyk
Sat, 10 Feb 2001 14:09:59 +1300, Brian Boutel [EMAIL PROTECTED] pisze: Can you demonstrate a revised hierarchy without Eq? What would happen to Ord, and the numeric classes that require Eq because they need signum? signum doesn't require Eq. You can use signum without having Eq, and you can

Re: Semantics of signum

2001-02-10 Thread Marcin 'Qrczak' Kowalczyk
Sat, 10 Feb 2001 11:25:46 -0500, Dylan Thurston [EMAIL PROTECTED] pisze: Can you elaborate? What do you mean by signum for functions? The pointwise signum? Yes. Then abs would be the pointwise abs as well, right? Yes. That might work, but I'm nervous because I don't know the semantics

Re: Show, Eq not necessary for Num [Was: Revamping the numeric classes]

2001-02-11 Thread Marcin 'Qrczak' Kowalczyk
Sun, 11 Feb 2001 13:37:28 +1300, Brian Boutel [EMAIL PROTECTED] pisze: Can you demonstrate a revised hierarchy without Eq? What would happen to Ord and the numeric classes with default class method definitions that use (==) either explicitly or in pattern matching against numeric literals?

Re: A sample revised prelude for numeric classes

2001-02-11 Thread Marcin 'Qrczak' Kowalczyk
Mon, 12 Feb 2001 17:24:37 +1300, Brian Boutel [EMAIL PROTECTED] pisze: class (Additive a) = Num a where (*) :: a - a - a one :: a fromInteger :: Integer - a -- Minimal definition: (*), one fromInteger 0 = zero fromInteger n | n 0

Re: A sample revised prelude for numeric classes

2001-02-11 Thread Marcin 'Qrczak' Kowalczyk
Sun, 11 Feb 2001 22:27:53 -0500, Dylan Thurston [EMAIL PROTECTED] pisze: Reading this, it occurred to me that you could explictly declare an instance of Powerful Integer Integer and have everything else work. No, because it overlaps with Powerful a Integer (the constraint on a doesn't matter

Re: Scalable and Continuous

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
arnings about mutual definitions giving bottoms. -- Marcin 'Qrczak' Kowalczyk ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
definitely not constrain the whole Prelude class system only to have convenient lifting of basic arithmetic. When it happens that an instance of an otherwise sane class for functions makes sense, then OK, but nothing more. -- Marcin 'Qrczak' Kowalczyk

Re: In hoc signo vinces (Was: Revamping the numeric classes)

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
or records, to multiply a tree by a scalar (btw.: Jn Fairbarn proposes (.*), I have in principle nothing against, but these operators is used elsewhere, in other languages, CAML and Matlab; I use (*) ). Please show a concrete proposal how Prelude classes could be improved. -- Marcin 'Qrczak

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Marcin 'Qrczak' Kowalczyk
Mon, 12 Feb 2001 12:04:39 +0100 (CET), Marcin 'Qrczak' Kowalczyk [EMAIL PROTECTED] pisze: This is my bet. I changed my mind: class Eq a = PartialOrd a where -- or Ord (), (), (=), (=) :: a - a - Bool -- Minimal definition: () or (=). -- For partial order

Re: Revised numerical prelude, version 0.02

2001-02-13 Thread Marcin 'Qrczak' Kowalczyk
Tue, 13 Feb 2001 18:32:21 -0500, Dylan Thurston [EMAIL PROTECTED] pisze: I'd like to copy this over to this revised library. But the numeric constants have to be wrapped in explicit calls to fromInteger. ghc's docs (the CVS version) say that -fno-implicit-prelude causes numeric literals

Re: Revised numerical prelude, version 0.02

2001-02-14 Thread Marcin 'Qrczak' Kowalczyk
Tue, 13 Feb 2001 18:32:21 -0500, Dylan Thurston [EMAIL PROTECTED] pisze: Here's a revision of the numerical prelude. I like it! class (Real a, Floating a) = RealFrac a where -- lifted directly from Haskell 98 Prelude properFraction :: (Integral b) = a - (b,a) truncate, round

Re: Scalable and Continuous

2001-02-14 Thread Marcin 'Qrczak' Kowalczyk
Wed, 14 Feb 2001 23:27:55 -0600, Matt Harden [EMAIL PROTECTED] pisze: I also wonder: should one be allowed to create new superclasses of an existing class without updating the original class's definition? It would not buy anything. You could not make use of the superclass in default

Re: Primitive types and Prelude shenanigans

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Fri, 16 Feb 2001 04:14:24 -0800, Simon Peyton-Jones [EMAIL PROTECTED] pisze: [Incidentally, if this is nhc's behaviour, it's not H98. The Report (tries to) stress that you get the "fromInt from the actual standard Prelude" regardless of what is in scope. That's why I'm not going to make it

Re: Primitive types and Prelude shenanigans

2001-02-16 Thread Marcin 'Qrczak' Kowalczyk
Thu, 15 Feb 2001 20:56:20 -0800, William Lee Irwin III [EMAIL PROTECTED] pisze: literal "5" gets mapped to (fromPositiveInteger 5) literal "-9" gets mapped to (fromNonZeroInteger -9) Note that when a discussed generic Prelude replacement framework is done, and ghc's rules are

Re: Things and limitations...

2001-05-17 Thread Marcin 'Qrczak' Kowalczyk
Mon, 14 May 2001 20:26:21 -0700, Juan Carlos Arevalo Baeza [EMAIL PROTECTED] pisze: class (MonadPlus (p s v)) = Parser p where item :: p s v v force :: p s v a - p s v a first :: p s v a - p s v a papply :: p s v a - s - [(a,s)] This MonadPlus superclass can't be

Re: 'lazy mindset' was: HUGS error: Unresolved overloading

2001-05-22 Thread Marcin 'Qrczak' Kowalczyk
I have a case where I don't know how to apply laziness well. Consider mutable containers (e.g. STArray or a database on disk). How to iterate over them? I see the following possibilities: * Give up laziness, provide only a conversion to the list of items. Since the conversion is monadic, it

Re: Type resolution problem

2001-05-28 Thread Marcin 'Qrczak' Kowalczyk
Mon, 28 May 2001 17:53:38 -0700, Juan Carlos Arevalo Baeza [EMAIL PROTECTED] pisze: Uncommenting the type expression above clears the error. But, why can't the compiler deduce it by itself? Monomorphism restriction strikes again. See section 4.5.5 in the Haskell 98 Report. A pattern binding

Re: Functional programming in Python

2001-05-29 Thread Marcin 'Qrczak' Kowalczyk
29 May 2001 22:44:38 +0200, Ketil Malde [EMAIL PROTECTED] pisze: Wouldn't x f g in a Forth'ish machine mean g(f,x) -- using standard math notation, for a change rather than g(f(x)) ? It depends whether f changes the value at top of the stack or only puts

Re: Multiple applications of a function

2001-09-16 Thread Marcin 'Qrczak' Kowalczyk
Sun, 16 Sep 2001 10:52:07 -0400 (EDT), Mark Carroll [EMAIL PROTECTED] pisze: To multiply apply a function, I'm currently using: multiplyApply f n a = (iterate f a) !! n ...is there a Prelude function I've missed that already does this? Unfortunately not. Could I be doing this

Re: Doing exercises from Haskell tutorial ...

2001-10-02 Thread Marcin 'Qrczak' Kowalczyk
02 Oct 2001 15:16:27 +0300, Dmitry Astapov [EMAIL PROTECTED] pisze: I need to define SetsAsLists as an instance of Set by supplying definitions for all Set methods, but definitions I wrote led me to adding additional constraints on union and memeber methods. What constraints? The class

Re: newtype | data

2001-10-05 Thread Marcin 'Qrczak' Kowalczyk
05 Oct 2001 11:53:05 -0700, Carl R. Witty [EMAIL PROTECTED] pisze: Data (T2 undefined) `seq` () *** Exception: Prelude.undefined Data (T3 undefined) `seq` () *** Exception: Prelude.undefined I can't think of a semantic difference between newtype and data with a single unary strict

Re: A small doubt

2001-10-19 Thread Marcin 'Qrczak' Kowalczyk
Sat, 20 Oct 2001 10:58:02 +0800 (GMT-8), Saswat Anand [EMAIL PROTECTED] pisze: I am wondering why this function should not work with input [x,y] (list with two elements) too, since third element is not referenced. What a pattern matches is independent from which of the variables it binds

Re: HaXml, memory usage and segmentation fault

2001-10-27 Thread Marcin 'Qrczak' Kowalczyk
27 Oct 2001 01:44:50 +0300, Dmitry Astapov [EMAIL PROTECTED] pisze: well, ghc-5.02 seems to dislike something inside XmlLib.hs - it could not find interface defs file for modules IOExts .. Perhaps the option -package lang would help. -- __( Marcin Kowalczyk * [EMAIL PROTECTED]

Re: streching storage manager

2001-09-29 Thread Marcin 'Qrczak' Kowalczyk
Sat, 29 Sep 2001 10:24:52 +0800 (GMT-8), Saswat Anand [EMAIL PROTECTED] pisze: As regard to Marcin's suggestion of using a list of compact arrays, although elements can be accessed faster, there will be a lot if redundancy since windows are overlapping. So consecutive arrays will contain

Re: Haskell - C/C++ comunication (sockets/pipes?)

2001-09-28 Thread Marcin 'Qrczak' Kowalczyk
Thu, 27 Sep 2001 23:06:51 +0100, Jorge Adriano [EMAIL PROTECTED] pisze: Seems to me like Hsk is not 'flushing' the output. I guess this is right (sorry, haven't checked). You can flush in two ways (using module IO): 1. At the beginning: hSetBuffering stdout LineBuffering or even

Re: streching storage manager

2001-09-28 Thread Marcin 'Qrczak' Kowalczyk
Fri, 28 Sep 2001 20:28:29 +0900, Dylan Thurston [EMAIL PROTECTED] pisze: This sounds perfectly suited to Haskell's standard lazy lists. If you only keep a pointer to the beginning of the data you need to work on, then Haskell will automatically read in exactly as much data as you use and GC

Re: Hashtable ADT

2001-10-06 Thread Marcin 'Qrczak' Kowalczyk
Sat, 6 Oct 2001 14:10:05 +0300, Cagdas Ozgenc [EMAIL PROTECTED] pisze: As I understand from the concepts of Functional Programming, it is not possible to implement a Hashtable ADT in Haskell language, where one can insert, and access values in O(1) complexity. It has to be implemented with

Re: Strictness making it worst?

2001-12-01 Thread Marcin 'Qrczak' Kowalczyk
Sat, 1 Dec 2001 15:58:47 +, Jorge Adriano [EMAIL PROTECTED] pisze: So my question is, is there anyway to force an argument to be reduced to *normal form*? The meaning of normal form (applied to an arbitrary Haskell type) is not precisely defined. It depends on the type and must be

Re: instance declarations

2001-12-09 Thread Marcin 'Qrczak' Kowalczyk
Fri, 7 Dec 2001 11:38:14 -0800, Mark P Jones [EMAIL PROTECTED] pisze: There's no solid technical reason for this, but Haskell doesn't allow it at the moment because there isn't an easy way to name an instance declaration. There is another problem: even if we created a syntax to name them, if

Re: cond and match

2001-12-09 Thread Marcin 'Qrczak' Kowalczyk
Fri, 7 Dec 2001 17:12:52 -0500 (EST), David Feuer [EMAIL PROTECTED] pisze: I'm wondering why Haskell doesn't support Scheme-like cond statements or a pattern matching predicate. I agree that both constructs make sense. The main objective is probably that the syntax is already quite rich and

Re: efficiency

2002-01-16 Thread Marcin 'Qrczak' Kowalczyk
Tue, 15 Jan 2002 13:06:58 +0100, Rijk-Jan van Haaften [EMAIL PROTECTED] pisze: This feature is one I consider among the worst in Haskell. If a datatype with just a single constructor can be optimized away, It can't. newtype has a different semantics than data, as others explained. It would be

Re: Monadic Call/CC?

2002-02-23 Thread Marcin 'Qrczak' Kowalczyk
Thu, 21 Feb 2002 19:36:13 -0800, Ashley Yakeley [EMAIL PROTECTED] pisze: data ContMonad p a = MkContMonad ((a - p) - p); [...] It's in GHC in module MonadCont, together with a monad transformer providing continuations and some instances. -- __( Marcin Kowalczyk * [EMAIL PROTECTED]

Re: AW: Editor Tab Expansion

2002-12-06 Thread Marcin 'Qrczak' Kowalczyk
Fri, 6 Dec 2002 12:09:46 +0100, Ingo Wechsung [EMAIL PROTECTED] pisze: No. My editor produces the ASCII code for horizontal tab, when I hit the tab key. Just as it produces the ASCII code for a when I hit the a key. That's how it should be. It shouln't, becase tabs are 8 spaces, which is

Re: infinite types

2003-07-16 Thread Marcin 'Qrczak' Kowalczyk
Dnia ro 16. lipca 2003 14:34, Ross Paterson napisa: type R m = m - Maybe (R m, [m]) I don't think there's an extension of Haskell with regular type unification. It's certainly possible, but there's an equivalent in standard Haskell: newtype R m = MkR (m - Maybe (R m, [m])) It will

Re: [newbie] UTF-8

2003-08-14 Thread Marcin 'Qrczak' Kowalczyk
Dnia pon 11. sierpnia 2003 00:49, Wolfgang Jeltsch napisa: The main problem is that you need binary I/O. Haskell 98 only provides text I/O. You don't need binary I/O for UTF-8 now; because implementations use ISO-8859-1, UTF-8 octets can be faked as characters by (chr . fromIntegral). The

Re: Prefix and postfix operators

2003-09-09 Thread Marcin 'Qrczak' Kowalczyk
Dnia ro 27. sierpnia 2003 20:48, Eugene Nonko napisa: Are there any plans to extend Haskell parser to support prefix and postfix operators? It will be just great for domain-specific languages. It always kind of bothered me that unary minus is special. Having only infix operators has the

Re: Newbie qustion about monads

2003-10-02 Thread Marcin 'Qrczak' Kowalczyk
W licie z czw, 02-10-2003, godz. 11:13, Juanma Barranquero pisze: The intent is that Counted objects count the number of times an operation is applied to them. As you discovered, there is no meaningful count of operations. If an operation doesn't do anything, do you count it? I suppose yes -

Re: Newbie qustion about monads

2003-10-02 Thread Marcin 'Qrczak' Kowalczyk
W licie z czw, 02-10-2003, godz. 12:59, Juanma Barranquero pisze: It's not about counting the operations (that's just an example), but accumulating any kind of state. For example: data Accum a = Ac [a] a instance Monad Accum where return x = Ac [x] x Ac _ x = f = let

Re: AW: Newbie qustion about monads

2003-10-02 Thread Marcin 'Qrczak' Kowalczyk
W licie z czw, 02-10-2003, godz. 14:25, Juanma Barranquero pisze: Yeah, I know. But it's difficult to ensure I'm satisfying the laws when I'm not entirely sure what do they ask from me... 1. (return x) = f == f x 2. m = return == m 3. (m = f) = g == m = (\x - f x = g) My intuition: 1 2.

Re: Cast from and to CChar

2003-10-27 Thread Marcin 'Qrczak' Kowalczyk
W licie z pon, 27-10-2003, godz. 20:47, Christian Buschmann pisze: Prelude Foreign.C castCCharToChar $ castCharToCChar '' I would expect that this returns '', but it returns '\252'. This is the same - instance Show Char displays non-ASCII characters that way. You get the same effect if you

Re: Cast from and to CChar

2003-10-28 Thread Marcin 'Qrczak' Kowalczyk
W licie z wto, 28-10-2003, godz. 12:30, Christian Buschmann pisze: But what is the good reason that show is doing it that way? Wouldn't it be better to output the '' as a '' instead of a code? Then don't use show, output characters directly (putChar, putStr). I thought that Char in Haskell

Re: Treating POSIX signals as exceptions?

2003-11-11 Thread Marcin 'Qrczak' Kowalczyk
W licie z pon, 10-11-2003, godz. 16:41, David Roundy pisze: I was wondering why System.Posix.Signals is as it is, and whether it could be rewritten to use exceptions, which seems like the obvious way to handle signals. I don't understand. How to handle a signal using exceptions such that the

Re: Graphical Programming Environments (was: ANNOUNCE: Release of Vit al, an interactive visual programming environment for Haskell)

2003-11-13 Thread Marcin 'Qrczak' Kowalczyk
W licie z czw, 13-11-2003, godz. 10:34, [EMAIL PROTECTED] pisze: If 'graphical' isn't taken too literally, you can think of a dialog per function with the possibility to specify pre and post conditions, tests, comments, etc. I still doubt it would be more convenient. Maybe it's just me, but I

Re: [Haskell-cafe] exceptions vs. Either

2004-08-03 Thread Marcin 'Qrczak' Kowalczyk
W licie z wto, 03-08-2004, godz. 13:05 +0200, Bjoern Knafla napisa: Herb Sutter gave these rules : An error is any failure that prevents a function from succeeding. Three main kind of errors: [...] These kinds don't explain much. They don't give a clue which errors to report by exceptions

Re: [Haskell-cafe] Writing binary files?

2004-09-12 Thread Marcin 'Qrczak' Kowalczyk
Sven Panne [EMAIL PROTECTED] writes: Hmmm, the Unicode tables start with ISO-Latin-1, so what would exactly break when we stipulate that the standard encoding for string I/O in Haskell is ISO-Latin-1? Additional encodings could be specified e.g. via a new open variant. That the encoding of

Re: [Haskell-cafe] Writing binary files?

2004-09-12 Thread Marcin 'Qrczak' Kowalczyk
Glynn Clements [EMAIL PROTECTED] writes: But the default encoding should come from the locale instead of being ISO-8859-1. The problem with that is that, if the locale's encoding is UTF-8, a lot of stuff is going to break (i.e. anything in ISO-8859-* which isn't limited to the 7-bit ASCII

  1   2   >