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

2005-02-02 Thread Ketil Malde
Glynn Clements <[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

Re: [Haskell-cafe] Point-free style

2005-02-11 Thread Ketil Malde
Matthew Roberts <[EMAIL PROTECTED]> writes: >> [Point-free] compositions of functions with arity greater than 1, >> [...] compositions of sections of composition or application, >> arrow notation without the sugar, and so forth---will always be more >> difficult to read and understand than the dir

[Haskell-cafe] Parsec question

2005-04-19 Thread Ketil Malde
Hi, I've started using Parsec for my parsing needs, and must say I'm very happy with it. There is one thing that I'm struggling with implementing though. Basically, I want to parse a file containing multiple records. I already have a parser for a single record, and of course I could parse the

Re: [Haskell-cafe] How to debug GHC

2005-04-26 Thread Ketil Malde
"Claus Reinke" <[EMAIL PROTECTED]> writes: > no direct answer to your question, but a general comment on the > original problem (speaking from bad experience;-): things like > "head" have no place in a Haskell program of any non-trivial size, > because of their useless error messages. I must say

Re: [Haskell-cafe] How to debug GHC

2005-04-26 Thread Ketil Malde
Donn Cave <[EMAIL PROTECTED]> writes: >> Ideally, I think something like this should be the default behavior >> for these functions. > But something like this should happen for any function, shouldn't > it? Any function where pattern match could fail, yes. (Or should that be any partial functi

Re: [Haskell-cafe] Unexported functions are evil

2005-05-15 Thread Ketil Malde
Peter Simons <[EMAIL PROTECTED]> writes: > The only reason I could think of is that a function is > considered to be "internal", meaning: You don't want users > of the module to rely on the function still being there (or > still working the same way) in any of the next revisions. Right. (I guess

Re: [Haskell-cafe] Text search

2005-05-16 Thread Ketil Malde
Gracjan Polak <[EMAIL PROTECTED]> writes: > find (isSuffixOf "needle") (inits "haystack") Hmm... While the result isn't exactly the same, I suspect using isPrefixOf and tails would be more efficient. > This one is beautiful, but not very practical. Unless you have very repetitive data and/or

Re: [Haskell-cafe] Buddha and GHC 6.4

2005-06-20 Thread Ketil Malde
Gour <[EMAIL PROTECTED]> writes: > This is really a nonsense. The word has lot of meanings. Let them take > a look in any Sanskrit dictionary. Hmm.. I must have displaced mine, but are you suggesting Enlightenment (the window manager) could be next? >> So what will happen in the long term? As ye

Re: [Haskell-cafe] New-bee question about seq in Parsec.Pos

2005-07-04 Thread Ketil Malde
Christoph Bauer <[EMAIL PROTECTED]> writes: > data SourcePos = SourcePos SourceName !Line !Column >deriving (Eq,Ord) > My poor haskell knowledge says me, that Line and Column is > always strict. Yes. > So, what does the following function? > forcePos :: SourcePos -> S

[Haskell-cafe] static typing and interactivity

2005-08-18 Thread Ketil Malde
Hi, One slight annoyance using Haskell is the inability to load modules with type problems in the interactive environment (i.e. GHCi). When I have a type error, it would be nice to have an interactive way to explore what the compiler thinks about the types involved -- as it is, I have to resort

Re: [Haskell-cafe] How to use STArray?

2005-08-25 Thread Ketil Malde
Greg Buchholz <[EMAIL PROTECTED]> writes: > Diff arrays have an immutable interface, but rely on internal updates in > place to provide fast functional update operator //. While a cool concept, ISTR that somebody benchmarked these some time ago, and found the performance to be fairly poor in prac

Re: [Haskell-cafe] How to use STArray?

2005-08-25 Thread Ketil Malde
Udo Stenzel <[EMAIL PROTECTED]> writes: > You messed the argument order to readArray up. Even with that repaired, > you'll need a type signature somewhere to help ghc resolve the > overloading of newArray and readArray, which is surprisingly tricky due > to the "s" that must not escape. I have s

Re: [Haskell-cafe] Re: [Haskell] pros and cons of static typing and side effects ?

2005-08-29 Thread Ketil Malde
Martin Vlk <[EMAIL PROTECTED]> writes: > http://www-i2.informatik.rwth-aachen.de/Staff/Current/michaelw/sttt-ml-haskell.pdf Interesting to see others' experiences, even if they are slightly negative. > It contains descriptions of lots of real-world problems and how They are only implementing T

Re: [Haskell-cafe] How to debug GHC

2005-09-02 Thread Ketil Malde
Nils Anders Danielsson <[EMAIL PROTECTED]> writes: > My program is failing with head [], or an array bounds error, or some > other random error, and I have no idea how to find the bug. Can you > help? > > Compile your program with -prof -auto-all (make sure you have the > profiling librari

Re: [Haskell-cafe] Basic Haskell Types Question

2005-09-16 Thread Ketil Malde
Adam Wyner <[EMAIL PROTECTED]> writes: > I really want to get the following sort of report for the type: > negationAtomicProps atomicProps1 :: PropList GHCi seems to get this right. Is that an option for you? -k -- If I haven't seen further, it is by standing in the footprints of giants _

Re: [Haskell-cafe] Trapped by the Monads

2005-09-21 Thread Ketil Malde
Bill Wood <[EMAIL PROTECTED]> writes: >> The variable mem is a so-called hybrid variable; it crunches >> together 2 different concepts: a boolean value (could I allocate >> memory?) and an address value (what is the address where I can find >> my allocated memory). IMO, Maybe is exactly the oppsi

Re: [Haskell-cafe] Basic type classing question.

2005-09-21 Thread Ketil Malde
Karl Grapone <[EMAIL PROTECTED]> writes: > I've just started learning Haskell, and I must admit I'm finding it a > bit hard to get my head around the typing system... Okay. > What I want to be able to do is add and remove fields while the system > is running, While I'm sure you'll get some adva

Re: [Haskell-cafe] mistake in Gentle Introduction

2005-09-22 Thread Ketil Malde
Michael Vanier <[EMAIL PROTECTED]> writes: > import Prelude hiding length > whereas the correct syntax is > import Prelude hiding (length) > I spent nearly an hour beating my head against this. Can someone fix this > in the documentation? Or, alternatively, fix the Haskell syntax? It wou

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Ketil Malde
Joel Reymont <[EMAIL PROTECTED]> writes: > If I don't cast then how do I convert this code? Uh, what is wrong with divMod? *Main Data.Word> (100::Word64) `divMod` (2^32) (2,1410065408) > doubleToInts d = runST ( [...] This will only give you a headache. :-) -k -- If I haven't s

Re: [Haskell-cafe] Examples of using STUArray + help with converting code

2005-10-14 Thread Ketil Malde
Joel Reymont <[EMAIL PROTECTED]> writes: > I must be missing something because I don't think the code below > converts a double. Yes, sorry, my bad. I was (and is) confused about what you wanted to do. -k -- If I haven't seen further, it is by standing in the footprints of giants ___

Re: [Haskell-cafe] Re: Interest in helping w/ Haskell standard

2005-10-14 Thread Ketil Malde
David Roundy <[EMAIL PROTECTED]> writes: >> Bah, simple libraries. They don't have to be part of the Standard >> Prelude. > I completely agree. I'd rather decrease the number of libraries defined in > the language itself and decouple library standardization from the > definition of the language

Re: [Haskell-cafe] Emptying a list

2005-10-14 Thread Ketil Malde
[EMAIL PROTECTED] writes: > Hi there, I'm just wondering if there is a command for emptying a list? Not really. If you want an empty list, you can use []. > Also, is there any way to incorporate list operations (concatenation in > particular) in a do-statement on lists? Every time I try it giv

Re: [Haskell-cafe] Nice way to calculate character frequency in a string

2005-10-27 Thread Ketil Malde
Udo Stenzel wrote: That raises the question: Should combining functions on containers be provided in a strict variant? Should strict application be the default? With the exception of lists, I generally tend to want strict behavior for collections. Combined with the principle of least surpris

Re: [Haskell-cafe] Nice way to calculate character frequency in a string

2005-10-27 Thread Ketil Malde
Scherrer, Chad wrote: Sorry to drag this thread out, but here's one more thing you might try... (This is the café, isn't it? :-) Another option is perhaps to pack both char and count in one Int and use some kind of Set. This should save some space, and possibly time as well (presuming bit

Re: [Haskell-cafe] Re: FPS: Finalizers not running (was Memoryusageoutside of the Haskell heap)

2005-11-10 Thread Ketil Malde
Sebastian Sylvan wrote: On 11/8/05, Jan-Willem Maessen <[EMAIL PROTECTED]> wrote: Just wanted to let people know that I've been working on improving Data.HashTable, with the help of Ketil Malde's badly performing code Always happy to help, of course - bad performance R us:-) Request

Re: [Haskell-cafe] Re: FPS: Finalizers not running (was Memoryusageoutside of the Haskell heap)

2005-11-12 Thread Ketil Malde
Jan-Willem Maessen wrote: I think that if I can get unsafeFreeze/unsafeThaw to work reliably, it'll finally outperform Data.Map on your example. I haven't yet played with the hash function, which looks kind of bad; there may be hope for improvement there as well. Great! User-level Thaw

Re: [Haskell-cafe] Re: [Haskell] Making Haskell more open

2005-11-14 Thread Ketil Malde
Gour wrote: Nobody said that DocBook does not work fine. However let me quote SPJ's message: However, I still wonder if there are things we could do that would make it easier for people to contribute. Here are two concrete suggestions: ^^^ - Make it possible for people to add comments,

Re: [Haskell-cafe] Re: [Haskell] Making Haskell more open

2005-11-14 Thread Ketil Malde
Wolfgang Jeltsch wrote: Hmm, MediaWiki already supports the concept of discussion pages. Yes, I know. Perhaps I was less than lucid, so to clarify: But I doubt that it's a good thing to maintain DocBook sources via a wiki. I think it would be best to keep the documentation in DocBook a

Re: [Haskell-cafe] doc/html -> wiki -> xml

2005-11-16 Thread Ketil Malde
Wolfgang Jeltsch wrote: Oh no! Converting LaTeX to HTML is terrible, in my opinion. One reason for this is that LaTeX isn't a markup language and provides a mixture of logical and visual macros. Conversely, I've occasionally tried to convert stuff - I think a TMR issue was one example, and

Re: [Haskell-cafe] Re: layout problem

2005-11-17 Thread Ketil Malde
Benjamin Franksen wrote: If your editor is a little smarter still, it can do the Haskell layout without braces automatically too. The emacs mode helps with this. Yi/hIDE should be able to do it perfectly once it's in a generally usable state. :) Hmm, how would your super intelligent text ed

Re: [Haskell-cafe] Records

2005-11-18 Thread Ketil Malde
Fraser Wilson <[EMAIL PROTECTED]> writes: >Isn't there a potential for confusion with function > composition (f . g)? > Perhaps, but I always have spaces on either side when it's function > composition. Good for you. Syntax that changes depending on spacing is my number one

Re: [Haskell-cafe] Records

2005-11-19 Thread Ketil Malde
Antti-Juhani Kaijanaho wrote: Ketil Malde wrote: [about A.b and A . b potentially meaning different things:] Syntax that changes depending on spacing is my number one gripe with the Haskell syntax I've generally considered that one of the good ideas in most current languages

Re: [Haskell-cafe] Records

2005-11-21 Thread Ketil Malde
"Simon Marlow" <[EMAIL PROTECTED]> writes: > I'm assuming you don't consider the distinction between '::' and ': :' > to be a problem - the justification for this is simple and logical: a > double colon '::' is a reserved symbol, in the same way that 'then' is a > reserved identifier. Intuitively

Re: [Haskell-cafe] Records

2005-11-22 Thread Ketil Malde
Cale Gibbard <[EMAIL PROTECTED]> writes: > This really isn't so bad in practice though. I've certainly never been > confused by it. Well, what can I say? Good for you? > You'd have to go out of your way to construct a > situation in which it's potentially confusing No. > There are much more

Re: [Haskell-cafe] returning lists

2005-12-01 Thread Ketil Malde
raptor <[EMAIL PROTECTED]> writes: > split _ [] = [] > split char (x:xs) > | x /= char = x : split char xs > | otherwise = [] > *Main> split 'x' str > "testing" > I want : > ["testing","split",...] > How do i do this. Collect the read chars in a temp, when the separator is dete

Re: [Haskell-cafe] Learning Haskell

2005-12-07 Thread Ketil Malde
Jimmie Houchin <[EMAIL PROTECTED]> writes: > I have been perusing the haskell.org site and reading some of the > tutorials. I just didn't want to expend lots of time just to find out > that my math skills were woefully inadequate. I am grateful to learn > that I can continue pursuing Haskell. Lo

Re: [Haskell-cafe] module names

2005-12-15 Thread Ketil Malde
"Scherrer, Chad" <[EMAIL PROTECTED]> writes: > module Main where > module A where > module B where > in a single file. This example is straight from chapter 5 of the Report, > and no mention is made (that I could find) about modules needing to be > in separate files. But this won't load in gh

Re: [Haskell-cafe] Optimizing a high-traffic network architecture

2005-12-15 Thread Ketil Malde
Einar Karttunen writes: > To matters nontrivial all the *nix variants use a different > more efficient replacement for poll. > Solaris has /dev/poll > *BSD (and OS X) has kqueue > Linux has epoll Since this is 'cafe, here's a page has some performance testing of epoll: http://lse.sourcefor

Re: [Haskell-cafe] +RTS -M800M

2005-12-17 Thread Ketil Malde
"Simon Marlow" <[EMAIL PROTECTED]> writes: > On 16 December 2005 10:05, Joel Reymont wrote: > >> I'm trying to restrict GHC to 800Mb of heap at runtime by passing in >> +RTS -M800M, the machine has 1Gb of memory and top shows free >> physical memory dropping below 175Mb. > -M800m should do more o

Re: [Haskell-cafe] First steps in Haskell

2005-12-20 Thread Ketil Malde
Chris Kuklewicz <[EMAIL PROTECTED]> writes: > Prelude> let { fac :: Integer -> Integer; fac 0 = 1; fac n | n > 0 = n * fac > (n-1) } As somebody made me aware just the other day, the bracer are only necessary for nested expressions. So you can just use ; for line breaks: Prelude> let fac :: I

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Ketil Malde
Neil Mitchell <[EMAIL PROTECTED]> writes: > I would have actually said Hugs, and especially the Windows front end > WinHugs was a lot more suitable for beginners than GHC, but the wiki > page very much gives the other impression. Which page are you referring to? I went to look, but couldn't find

Re: [Haskell-cafe] Tutorial uploaded

2005-12-21 Thread Ketil Malde
Paul Moore <[EMAIL PROTECTED]> writes: > One thing I'd consider adding is something along the lines of a section: > == So how do I write "Hello, world"? == I've gone and done it. I've perhaps been heavy handed on the original page, so feel free to complain and/or fix it. -k -- If I haven't se

Re: [Haskell-cafe] Re: When to teach IO

2005-12-22 Thread Ketil Malde
"Bayley, Alistair" <[EMAIL PROTECTED]> writes: > Hear, hear. Compilers, and computationally complex programs in general, > are atypical. IMO, a lot of programming these days is integration work > i.e. shuffling and transforming data from one system to another, or > transforming data for reports, e

Re: lazy file reading in H98

2000-09-05 Thread Ketil Malde
Simon Peyton-Jones <[EMAIL PROTECTED]> writes: > I'm not prepared to add new functions to Haskell 98, but I think > the clarification of (1) or (2) below would be useful. (2) is nice > but it makes *all* file reading more expensive, perhaps significantly > so (e.g. making a complete copy of the

Re: XML Programming Languages...

2000-09-15 Thread Ketil Malde
Doug Ransom <[EMAIL PROTECTED]> writes: > I have configured this message so that replies should go to haskell-cafe > automatically. Sure. However, I do 'f' to follow up, which causes both adresses to be included :-) (Removed haskell@manually) > What xml parser are you using XML in haskell? I

Re: Literate Programming

2000-09-27 Thread Ketil Malde
"D. Tweed" <[EMAIL PROTECTED]> writes: > Unfortunately the last time I looked at CWEB it still had the same idea > about identifiers as WEB itself, namely that if they match textually > they are the same, which makes the automatic indexes produced less useful > for C++: I've got twelve classes al

Re: GHCi, Hugs (was: Mixture ...)

2000-12-11 Thread Ketil Malde
Koen Claessen <[EMAIL PROTECTED]> writes: [Dead/dying compilers/interpreter] > I know of nobody who is starting to implement a Haskell > compiler from scratch. What do people think: is this > a worrying situation? Only if the remaining tools are insufficient, IMHO. It is questionable whether t

Re: Revamping the numeric classes

2001-02-07 Thread Ketil Malde
"Ch. A. Herrmann" <[EMAIL PROTECTED]> writes: > moved to haskell-cafe No, but *now* it is. (Does haskell@ strip Reply-To? Bad list! Bad!) > the problem is that the --majority, I suppose?-- of mathematicians > tend to overload operators. They use "*" for matrix-matrix > multiplication as well a

Re: Revamping the numeric classes

2001-02-07 Thread Ketil Malde
Dylan Thurston <[EMAIL PROTECTED]> writes: > On Wed, Feb 07, 2001 at 01:57:41PM -0500, Dylan Thurston wrote: > > ... One point that has not been made: given a class > > setup like > > > > then naive users can continue to use (Num a) in contexts, and the same > > programs will continue to work.

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

2001-02-09 Thread Ketil Malde
Brian Boutel <[EMAIL PROTECTED]> writes: >> The fact that equality can be trivially defined as bottom does not imply >> that it should be a superclass of Num, it only explains that there is an >> ugly way of working around the problem. > There is nothing trivial or ugly about a definition that r

Re: A sample revised prelude for numeric classes

2001-02-12 Thread Ketil Malde
[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) writes: >> Why do you stop at allowing addition on Dollars and not include >> multiplication by a scalar? > Perhaps because there is no good universal type for (*). > Sorry, it would have to have a different symbol. Is this ubiquitous enough that we

Re: Primitive types and Prelude shenanigans

2001-02-15 Thread Ketil Malde
William Lee Irwin III <[EMAIL PROTECTED]> writes: > Some analysis of the value of the literal would need to be > incorporated so that something like the following happens: > literal "0" gets mapped to zero :: AdditiveMonoid t => t > literal "1" gets mapped to one :: MultiplicativeMon

Re: Primitive types and Prelude shenanigans

2001-02-22 Thread Ketil Malde
[EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) writes: > 'negate' defined, as it's obviously meaningless for them. We can put > 'fromInteger' in some class and 'negate' in its subclass, and make > only the former instance for natural numbers. Nitpick: not necessarily its subclass, either. We can

Re: Functional programming in Python

2001-05-20 Thread Ketil Malde
"Manuel M. T. Chakravarty" <[EMAIL PROTECTED]> writes: > You want to be able to write > f 1 2 + g 3 4 > instead of > (f 1 2) + (g 3 4) I do? Personally, I find it a bit confusing, and I still often get it wrong on the first attempt. The good thing is that the rule is simple to remember.

Re: Functional programming in Python

2001-05-29 Thread Ketil Malde
Jerzy Karczmarczuk <[EMAIL PROTECTED]> writes: >> BTW, before I knew Haskell I exprimented with a syntax in which 'x f' >> is the application of 'f' to 'x', and 'x f g' means '(x f) g'. > Hmmm. An experimental syntax, you say... > Oh, say, you reinvented FORTH? Wouldn't x f g in a For

Re: Why is there a space leak here?

2001-06-07 Thread Ketil Malde
Fergus Henderson <[EMAIL PROTECTED]> writes: > If experts like Alastair Reid > have trouble understanding the operational behaviour of simplified > examples like this one, how are ordinary programmers to cope with > complicated programs? Is lazy functional programming too difficult for > ordinar

Re: update in-place

2001-10-02 Thread Ketil Malde
"Cagdas Ozgenc" <[EMAIL PROTECTED]> writes: > Could you help me on this notation? Perhaps? >> data Foo = Foo { a :: Int, b :: String } This declares a Foo constructor with two named fields, and Int "a" and a String "b". This is equivalent to declaring data Foo = Foo Int String but w

Re: streching storage manager

2001-09-28 Thread Ketil Malde
Saswat Anand <[EMAIL PROTECTED]> writes: > 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 almost same data. Hmmm - a circular

Re: UniCode

2001-10-07 Thread Ketil Malde
Dylan Thurston <[EMAIL PROTECTED]> writes: > Right. In Unicode, the concept of a "character" is not really so > useful; After reading a bit about it, I'm certainly confused. Unicode/ISO-10646 contains a lot of things that aren'r really one character, e.g. ligatures. > most functions that tradi

Re: Unicode support

2001-10-09 Thread Ketil Malde
[Posted to haskell-cafe, since it's getting quite off topic] "Kent Karlsson" <[EMAIL PROTECTED]> writes: >>> for a long time. 16 bit unicode should be gotten rid of, being the worst >>> of both worlds, non backwards compatable with ascii, endianness issues >>> and no constant length encoding...

Re: Unicode support

2001-10-09 Thread Ketil Malde
"Kent Karlsson" <[EMAIL PROTECTED]> writes: >> You have endianness issues, and you need to explicitly type text files >> or insert BOMs. > You have to distinguish between the encoding form (what you use internally) > and encoding scheme (externally). Good point, of course. Most of the argume

Re: = vs ->

2001-10-09 Thread Ketil Malde
Mark Carroll <[EMAIL PROTECTED]> writes: > On Tue, 9 Oct 2001, Ashley Yakeley wrote: >> At 2001-10-09 11:55, Mark Carroll wrote: >>> What is the rationale for when Haskell demands a "=" and when it >>> demands a "->"? Okay, I can't give you anything formal, but here's my intuitive understandin

Re: Haskell-beginners problem with memory consuption

2003-10-02 Thread Ketil Malde
Petter Egesund <[EMAIL PROTECTED]> writes: > I load my file in one chunk, and does a lot of substitutes on the string - > this is quick eating all my memory and the computers start to get really > slow. Keep in mind that Strings are lists of characters. I think (somebody correct me if I'm wrong)

Re: SV: Haskell-beginners problem with memory consuption

2003-10-02 Thread Ketil Malde
Petter Egesund <[EMAIL PROTECTED]> writes: > fun :: String -> String > look for pat1 in string - if found subst with sub1 > look for pat2 in string - if found subst with sub2 > look for pat3 in string - if found subst with sub3 > recurse until no pattern is found I would struc

Re: Limiting resources on a per-function basis?

2004-01-05 Thread Ketil Malde
Jeff Newbern <[EMAIL PROTECTED]> writes: > Thanks for your input. I am mainly interested in this functionality to > enhance my unit tests. I want to be able to run test cases with limits > on time, heap, stack, etc. and fail the test if it exceeds the limits. Well, if you can isolate the tests

Re: pet project - 7 Millennium Prize problemss

2004-01-05 Thread Ketil Malde
Christopher Milton <[EMAIL PROTECTED]> writes: > I think Haskell can be used to solve several, if not all, of > the seven problems. What's this? Is there an URL with more information? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Re: Hi, I have a question!

2004-01-11 Thread Ketil Malde
Derek Elkins <[EMAIL PROTECTED]> writes: >> Either use a different name for your operator, or specify the "+" that >> you want by writing "OperationTest.+" instead of "+". > You can also hide the Prelude (+), though it is a somewhat useful > function. Wouldn't making Nat an instance of Num also

Re: [Haskell-cafe] Converting String

2004-01-26 Thread Ketil Malde
Alex Gontcharov <[EMAIL PROTECTED]> writes: > I'm fairly new to Haskell, I'd like to know how to convert > a list of Strings of type IO [String] to Int. Ah... an IO [String] is *not* a list of strings, it is an IO action that can produce a list of strings. You can only get at the strings inside

Re: [Haskell-cafe] elemt from list

2004-01-27 Thread Ketil Malde
"Pajo Patak" <[EMAIL PROTECTED]> writes: > I want to return a list, from and list of lists (all integers), where > is the erroe in the code? > nthList :: [[a]] -> Int -> [a] > nthList ([x]:xs) 1 = [x] > nthList ([x]:xs) (n+1) = nthListh xs n Did you try it at all? Prelude> let { nthList

Re: [Haskell-cafe] Type Class Query

2004-02-03 Thread Ketil Malde
Hal Daume III <[EMAIL PROTECTED]> writes: >> class Null a where >> nullify :: a -> a Hmm...why not class Null a where null :: a (you are just throwing away the parameter anyway)? >> I then tried the following: >> >> instance Num a => Null a where >> nulli

Re: [Haskell-cafe] Type Class Query

2004-02-03 Thread Ketil Malde
"Iavor S. Diatchki" <[EMAIL PROTECTED]> writes: > it refers to type constructor. Okay, thanks for the clarification. > since value constructors are not allowed > in the "instance head" the terminology is not ambiguous. You know, I'm going to have to take issue with this. Yes, it's not ambigo

Re: [Haskell-cafe] Outstanding context : (Num b, Random b)

2004-02-26 Thread Ketil Malde
"horsh" <[EMAIL PROTECTED]> writes: > Could anyone please explain why these two things are not equivalent: One of them has a type signature? -kzm -- If I haven't seen further, it is by standing in the footprints of giants ___ Haskell-Cafe mailing lis

Re: [Haskell-cafe] ????Pattern match(es) are overlapped???

2004-03-22 Thread Ketil Malde
"Arjan van IJzendoorn" <[EMAIL PROTECTED]> writes: >>newtype Method = Method String >>getMethod = Method "GET" >>putMethod = Method "PUT" >>doMeth getMethod = ... >>doMeth putMethod = ... > You will have to write: > > doMeth (Method "GET") = ... > doMeth (Method "PUT") = ...

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-06 Thread Ketil Malde
"Russ Lewis" <[EMAIL PROTECTED]> writes: > Another newbie question: Is it possible to catch _|_ - that is, to > encounter it, handle it and continue? Since _|_ is the value of a non-terminating computation, this requires you to solve the halting problem. GHC does occasionally detect loops, but f

Re: [Haskell-cafe] Newbie: Is it possible to catch _|_ ?

2004-04-06 Thread Ketil Malde
"Russ Lewis" <[EMAIL PROTECTED]> writes: > Oh. I was figuring that the runtime would detect _|_ whenever > evaluation requires that it calculate a given expressoin, and that > expression is currently being evaluated...that is, some subset of an > expression evaluates to the expression itself. Yo

Re: [Haskell-cafe] WildCard question

2004-04-13 Thread Ketil Malde
Paul Cosby <[EMAIL PROTECTED]> writes: > Every time I try to use [underscore] in an definition it says > something like the symbol /017 is not recognised Could that be \017, i.e. octal 17 (defined in ASCII as SI, whatever that may be)? > Any help suggestions? Wild guess: Are your files using th

[Haskell-cafe] Re: [Haskell] Re: sizeFM type

2004-04-27 Thread Ketil Malde
[Moved to -cafe at SPJ's request] "Serge D. Mechveliani" <[EMAIL PROTECTED]> writes: > On Mon, Apr 26, 2004 at 10:09:18PM +0200, Ketil Malde wrote: >> "Serge D. Mechveliani" <[EMAIL PROTECTED]> writes: >>>

Re: [Haskell-cafe] Re: sizeFM type

2004-04-28 Thread Ketil Malde
"S. Alexander Jacobson" <[EMAIL PROTECTED]> writes: > assuming Moore's law lasts I suspect Moore's law is dead or dying. Intel just announced the latest "Prescott" P4 at 3.6 GHz, up from 3.2 last June. That's only a 12.5% increase. One year before that, it was about 2.5GHz, or almost 30%. I di

Re: [Haskell-cafe] Re: (to haskell-cafe) comment on language shootout

2004-06-21 Thread Ketil Malde
"Iavor S. Diatchki" <[EMAIL PROTECTED]> writes: > one thing i don't like about programming contests, is that usually > time is very limited, so often one ends up with terrible hacks that > kind of work... I'm not so sure - at least in earlier contests, when programs were submitted, they were fe

Re: [Haskell-cafe] some newbie FFI questions

2004-07-01 Thread Ketil Malde
John Kozak <[EMAIL PROTECTED]> writes: > data Pixel a = Pixel !a !a !a deriving Show > I use ImageMagick to load the image, then build an Array of Pixel > Floats. Building the array takes 45 seconds on a 2.5Ghz P4 with > code compiled -O2, which seems slow to me - are my expectations > u

Re: [Haskell-cafe] migrating from python

2004-07-13 Thread Ketil Malde
paolo veronelli <[EMAIL PROTECTED]> writes: > All these are very natural with dictionaries, so I'd like to figure > out the haskell view. I've no clue what you're doing (or for that matter, what RDFs are), but is there any reason Data.FiniteMap doesn't do the job? -kzm -- If I haven't seen furt

Re: [Haskell-cafe] optimising for vector units

2004-07-26 Thread Ketil Malde
MR K P SCHUPKE <[EMAIL PROTECTED]> writes: > Well I have to say the dataflow style of lazy programming made me think > Haskell would be ideal for multi-processor use (and now HyperThreading > is common most PCs have more than one processor from the code's point > of view)... > I was disappointed

Re: [Haskell-cafe] optimising for vector units

2004-07-26 Thread Ketil Malde
Jon Cast <[EMAIL PROTECTED]> writes: >> factor c constant overhead, > ^^ > What makes you think the overhead is constant? (Referring to the overhead introduced by boxing and such, not parallelizing. Sorry if that wasn't clear) -kzm -- If I haven't seen further, it i

<    5   6   7   8   9   10