Re: [Haskell-cafe] Thompson's Exercise 9.13

2005-04-10 Thread Henning Thielemann
On Mon, 11 Apr 2005, Christoph Bauer wrote: Kaoru Hosokawa [EMAIL PROTECTED] writes: I've been working through Thompson's exercises and got to one I could not solve. It's Exercise 9.13. This is where I need to define init using foldr. init :: [a] - [a] init Greggery Peccary ~

[Haskell-cafe] predicates in XML toolboxes

2005-04-12 Thread Henning Thielemann
The XML toolboxes HaXml, HXML and the XML toolbox uses one function type (called filter) for different purposes. The functions of types predicates a - Bool selectors, transformatorsa - a list-valued functionsa - [a] are all implemented with the one type (a - [a]).

Re: [Haskell-cafe] [Q] A typing problem

2005-04-13 Thread Henning Thielemann
On Wed, 13 Apr 2005, Didier Verna wrote: I'm trying to write a function that combines folding and mapping. This function would take two arguments (a folding function and a mapping function), and would return a function of one argument (a list of 'a''s) returning a 'a'. The idea is to write

Re: [Haskell-cafe] foldr1 min [(maxBound::Int)%1,1 % 2]

2005-04-13 Thread Henning Thielemann
On Wed, 13 Apr 2005, Bo Herlin wrote: Hi How come foldr1 min [(maxBound::Int) % 1,1 % 2] 2147483647 % 1 I guess that foldr1 min == minimum but foldr1 min [2147483647 % 1,1 % 2] 1 % 2 Why??? The first one certainly causes an overflow with machine word Ints whereas 2147483647 is an Integer and

Re: [Haskell-cafe] String search algorithms

2005-04-25 Thread Henning Thielemann
On Mon, 25 Apr 2005, Bayley, Alistair wrote: I'm a bit puzzled to find no sub-string search in the Haskell libraries (unless there's some neat composition of the existing Data.List functions that I've missed). Google doesn't help much either. I've found a KMP implementation:

Re: [Haskell-cafe] String search algorithms

2005-04-25 Thread Henning Thielemann
On Mon, 25 Apr 2005, Henning Thielemann wrote: On Mon, 25 Apr 2005, Bayley, Alistair wrote: I'm a bit puzzled to find no sub-string search in the Haskell libraries (unless there's some neat composition of the existing Data.List functions that I've missed). Google doesn't help much either. I've

[Haskell-cafe] Re: about Ghci

2005-04-29 Thread Henning Thielemann
On Thu, 28 Apr 2005, Peter Simons wrote: SCOTT J writes: What do I have to do in order not having to type always :set -fglasgow-exts Add the line {-# OPTIONS -fglasgow-exts #-} at the top of the source code. Then the flag will be set when you load the module. This option is local to each

[Haskell-cafe] RE: RFE: Extensible algebraic user-defined data types?

2005-04-29 Thread Henning Thielemann
On Fri, 29 Apr 2005, Simon Peyton-Jones wrote: | Regarding reusing constructor names across several datatypes: is it | possible to qualify them with their enclosing datatype name, like | Maybe.Nothing where there is a name conflict? Then I might reuse | Nothing in my hypothetical data type, and it

Re: [Haskell-cafe] Clarification on proof section of HS: The Craft of FP

2005-05-02 Thread Henning Thielemann
On Mon, 2 May 2005, Echo Nolan wrote: Hello all, My copy of HS: The Craft Of FP just arrived and I was reading section 8.5 about induction. On page 141, Simon Thompson gives a method of proving properties of functions on lists: 1) Prove that the property holds for the null list

Re: [Haskell-cafe] Clarification on proof section of HS: The Craft of FP

2005-05-02 Thread Henning Thielemann
On Mon, 2 May 2005, Daniel Carrera wrote: Daniel Fischer wrote: Both do, but in Explanation 2, you omitted 'finite' a couple of times. Well, I also omited the word countable. I figure it's understood since computers only deal with finite data. And given an infinite list, any finite head of it

RE: [Haskell-cafe] Mutual recursive modules with GHC: Classes, instances

2005-05-04 Thread Henning Thielemann
On Wed, 4 May 2005, Simon Peyton-Jones wrote: hi-boot files can't contain class declarations. This should be checked, but isn't, hence puzzling message. GHC 6.4 has a better setup. Actually, it still doesn't check for absence of class decls, but it will shortly. This means it is impossible to

RE: [Haskell-cafe] Mutual recursive modules with GHC: Classes, instances

2005-05-04 Thread Henning Thielemann
On Wed, 4 May 2005, Simon Peyton-Jones wrote: I'm afraid so, as of today. It's the kind of thing that could get fixed if enough people wanted it, but at the moment it's pretty low on the list. Mutual dependent classes in separate modules are a consequence of rigorously defining exactly one class

Re: [Haskell-cafe] APIs

2005-05-25 Thread Henning Thielemann
On Wed, 25 May 2005, Benjamin Franksen wrote: BTW, how about putting all these different ideas on the Haskell wiki? Great idea! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Type extensions

2005-06-01 Thread Henning Thielemann
On Wed, 1 Jun 2005, Thomas Davie wrote: Hi, I was wondering if I hat missed something and it was possible to do this within the Haskell type system or not... Essentially I would like some sort of inderritance property for Haskell types, I often find myself wanting to for example extend

Re: [Haskell-cafe] Type extensions

2005-06-01 Thread Henning Thielemann
On Wed, 1 Jun 2005, Thomas Davie wrote: On 1 Jun 2005, at 15:54, Henning Thielemann wrote: What about data MyTree a = Branch a (MyTree a) (MyTree a) | Node a and the types MyTree () MyTree Bool MyTree (Bool, Int) ? That's exactly what I would normally do, but my data

Re: [Haskell-cafe] Using type classes for polymorphism of data constructors

2005-06-13 Thread Henning Thielemann
On Sat, 11 Jun 2005, Thomas Sutton wrote: The end goal in all of this is that the user (perhaps a logician rather than a computer scientist) will describe the calculus they wish to use in a simple DSL. This DSL will then be translated into Haskell and linked against some infrastructure

Re: [Haskell-cafe] Annotating calculations

2005-06-15 Thread Henning Thielemann
On Wed, 15 Jun 2005, Rene de Visser wrote: Hello, I have a somewhat complicated calculation programmed in Haskell. This calculation is coded without using monads. I want to also produce a report describing the details of this calculation for each particular set of inputs. e.g. Number of

Re: [Haskell-cafe] type inference and named fields

2005-06-23 Thread Henning Thielemann
On Thu, 23 Jun 2005, Lennart Augustsson wrote: A somewhat similar problem exists even without fields: foo :: Either a b - Either () b foo (Left _) = Left () foo x@(Right _) = x Since Haskell type checking doesn't use the information gained by pattern matching to refine types we just have

Re: [Haskell-cafe] type inference and named fields

2005-06-23 Thread Henning Thielemann
On Thu, 23 Jun 2005, Malcolm Wallace wrote: module Fieldbug where data Fields a = VariantWithTwo { field1 :: a , field2 :: a } | VariantWithOne { field1 :: a } The key point here is that the data structure with named fields has more than one constructor, and

Re: [Haskell-cafe] type inference and named fields

2005-06-23 Thread Henning Thielemann
On Thu, 23 Jun 2005, Christian Maeder wrote: Malcolm Wallace wrote: voidcast :: Fields a - Fields Void voidcast v@(VariantWithTwo{}) = v { field1 = Void , field2 = Void } voidcast v@(VariantWithOne{}) = v { field1 = Void } I would not expect that updating only field1 can change the type of

Re: [Haskell-cafe] Why distinct tyvars in instance declarations?

2005-06-26 Thread Henning Thielemann
On Sun, 26 Jun 2005, Daniel Fischer wrote: Am Samstag, 25. Juni 2005 21:22 schrieb Josh Hoyt: Hello, I'm a new Haskeller, and I'm running into a problem attempting to declare certain types as instances. I was attempting something that's effectively equivalent to: class Foo a

Re: [Haskell-cafe] Noob error: Type b - c b Does not match IO a

2005-06-26 Thread Henning Thielemann
On Sun, 26 Jun 2005, Daniel Fischer wrote: m x y = if x==0 then 0 else x*y Plain foldr m 1 does fine, in fact much better than foldl' (*) 1 . upTo (== 0), both in hugs and ghc, regarding speed and memory usage. E.g. foldr m 1 [a,b,c] means m a (m b (m c 1))) That is, it is

Re: [Haskell-cafe] type inference and named fields

2005-06-27 Thread Henning Thielemann
On Mon, 27 Jun 2005, Malcolm Wallace wrote: I can only repeat myself, that the field being updated (and type-converted) is only one of many, and all other fields should carry the same value in the updated structure as in the original. There is no good way to write this at the moment. If

Re: [Haskell-cafe] Noob error: Type b - c b Does not match IO a

2005-06-27 Thread Henning Thielemann
On Mon, 27 Jun 2005, Daniel Fischer wrote: Am Sonntag, 26. Juni 2005 21:02 schrieben Sie: On Sun, 26 Jun 2005, Daniel Fischer wrote: m x y = if x==0 then 0 else x*y Plain foldr m 1 does fine, in fact much better than foldl' (*) 1 . upTo (== 0), both in

Re: [Haskell-cafe] Re: ANNOUNCE: GHC survey results

2005-06-28 Thread Henning Thielemann
On Tue, 28 Jun 2005, Bulat Ziganshin wrote: you are completely skipped the point that these is just for C++ programmers wanting to program in Haskell and aimed to give them faster learning path and easy to use instruments Not to forget to make learning easier for programmers of Perl, Ruby,

Re: [Haskell-cafe] Re: ANNOUNCE: GHC survey results

2005-06-28 Thread Henning Thielemann
On Tue, 28 Jun 2005, robert dockins wrote: you are completely skipped the point that these is just for C++ programmers wanting to program in Haskell and aimed to give them faster learning path and easy to use instruments Not to forget to make learning easier for programmers of Perl, Ruby,

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Alberto Ruiz wrote: In my work I often need linear algebra algorithms and other numeric computations. Nice coincidence: http://www.haskell.org//pipermail/libraries/2005-June/003936.html An option is using scientific computing systems like Matlab, Mathematica, Maple,

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Alberto Ruiz wrote: On Wednesday 29 June 2005 12:31, Henning Thielemann wrote: On Wed, 29 Jun 2005, Alberto Ruiz wrote: In my work I often need linear algebra algorithms and other numeric computations. Nice coincidence: http://www.haskell.org//pipermail

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Henning Thielemann wrote: On Wed, 29 Jun 2005, Alberto Ruiz wrote: On Wednesday 29 June 2005 12:31, Henning Thielemann wrote: On Wed, 29 Jun 2005, Alberto Ruiz wrote: In my work I often need linear algebra algorithms and other numeric computations. Nice

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Jacques Carette wrote: 9. There are row vectors and column vectors, and these are different types. You get type errors if you mix them incorrectly. What do you mean with row vectors and column vectors are different types? Do you mean that in a well designed library they

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Jacques Carette wrote: If we instead distinguish row and column vectors because we treat them as matrices, then the quadratic form x^T * A * x denotes a 1x1 matrix, not a real. But if you consider x to be a vector without orientation, writing down x^T is

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Dan Piponi wrote: On Wed, 29 Jun 2005, Jacques Carette wrote: Distinction of row and column vectors is a misconcept Row and column vectors are sometimes worth distinguishing because they can represent entirely different types of object. For example, if a column vector

RE: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Conal Elliott wrote: On row column vectors, do you really want to think of them as {1,...,n)-R? They often represent linear maps from R^n to R or R to R^n, which are very different types. Similarly, instead of working with matrices, how about linear maps from R^n to

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Jacques Carette wrote: In fact, type classes in Haskell is a *great* way to do just that! I agree. I'm also aware of that I mean different objects when I write uniformly '1'. But I know that they are somehow different. I'm also ok with not writing a conversion from say the

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-29 Thread Henning Thielemann
On Wed, 29 Jun 2005, Jacques Carette wrote: sarcasmNext thing you know, you'll want a different 'application' symbol for every arity of function, because they are ``different''. /sarcasm Btw. there is less sarcasm in it as may you think. There was already a proposal to extend function

RE: [Haskell-cafe] matrix computations based on the GSL

2005-06-30 Thread Henning Thielemann
Let me a bit elaborate on what I wrote yesterday. On Wed, 29 Jun 2005, Henning Thielemann wrote: I think matrices and derivatives are very different issues. I have often seen that the first derivative is considered as vector, and the second derivative is considered as matrix. In this spirit

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-30 Thread Henning Thielemann
On Thu, 30 Jun 2005, David Roundy wrote: If we support matrix-matrix multiplication, we already automatically support matrix-column-vector and row-vector-matrix multiplication, whether or not we actually intend to, unless you want to forbid the use of 1xn or nx1 matrices. So (provided we

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-30 Thread Henning Thielemann
On Thu, 30 Jun 2005, Jacques Carette wrote: Henning Thielemann wrote: I'm uncertain about how who want to put the different kinds of multiplication into one method, even with multi-parameter type classes. You need instances (*) :: Matrix - Matrix - Matrix (*) :: RowVector - Matrix

Re: [Haskell-cafe] matrix computations based on the GSL

2005-06-30 Thread Henning Thielemann
On Thu, 30 Jun 2005, Jacques Carette wrote: Henning Thielemann wrote: Data Orientation = Row | Column Data Vector a = Vector Orientation [a] In the first mail you wrote 9. There are row vectors and column vectors, and these are different types. You get type errors if you mix them

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-05 Thread Henning Thielemann
On Tue, 5 Jul 2005, Keean Schupke wrote: David Roundy wrote: In short, especially since the folks doing the work (not me) seem to want plain old octave-style matrix operations, it makes sense to actually do that. *Then* someone can implement an ultra-uber-tensor library on top of that, if

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-05 Thread Henning Thielemann
On Tue, 5 Jul 2005, Keean Schupke wrote: Henning Thielemann wrote: I'm uncertain about how who want to put the different kinds of multiplication into one method, even with multi-parameter type classes. You need instances (*) :: Matrix - Matrix - Matrix (*) :: RowVector - Matrix

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-06 Thread Henning Thielemann
On Tue, 5 Jul 2005, Michael Walter wrote: On 7/5/05, Henning Thielemann [EMAIL PROTECTED] wrote: The example, again: If you write some common expression like transpose x * a * x then both the human reader and the compiler don't know whether x is a true matrix or if it simulates

Re: [Haskell-cafe] polymorphic type

2005-07-06 Thread Henning Thielemann
On Wed, 6 Jul 2005, wenduan wrote: Dear all, Suppose we have defined two functions as below: case :: (a - c,b - c) - Either a b - c case (f, g) (Left x) = f x case (f, g) (Right x) = g x It seems to be case == uncurry either Prelude :info either -- either is a variable either ::

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-07 Thread Henning Thielemann
On Thu, 7 Jul 2005, David Roundy wrote: On Tue, Jul 05, 2005 at 08:17:58PM +0200, Henning Thielemann wrote: The example, again: If you write some common expression like transpose x * a * x then both the human reader and the compiler don't know whether x is a true matrix

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-07 Thread Henning Thielemann
On Thu, 7 Jul 2005, Henning Thielemann wrote: Also note that if you have several vectors x for which you want to compute the dot product with metric A, and if you want to do this efficiently, you'll have to convert your list of vectors into a matrix anyways. If you bundle some vectors

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-07 Thread Henning Thielemann
On Thu, 7 Jul 2005, David Roundy wrote: Also note that if you have several vectors x for which you want to compute the dot product with metric A, and if you want to do this efficiently, you'll have to convert your list of vectors into a matrix anyways. Writing functions of vectors instead

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-07 Thread Henning Thielemann
On Thu, 7 Jul 2005, Henning Thielemann wrote: fft([1,0;0,0]) ans = 1 0 1 0 Also funny: conv([1;1],[1,1]) ans = 1 2 1 conv([1;1;1],[1,1]) ans = 1 2 2 1 ___ Haskell-Cafe mailing list

RE: [Haskell-cafe] matrix computations based on the GSL

2005-07-07 Thread Henning Thielemann
On Thu, 7 Jul 2005, Conal Elliott wrote: Maybe we could solve this problem in a simple and general way by working with a more abstract notion of linear maps, rather than the matrices commonly used to represent linear maps. Instead of Matrix n m, where n and m are either integers (requiring

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-07 Thread Henning Thielemann
On Thu, 7 Jul 2005, Alberto Ruiz wrote: Hello! Thank you very much for all your suggestions. A new version of the library can be found at: http://dis.um.es/~alberto/hmatrix/matrix.html I get time-out/ :-( - Vector and Matrix are now different types with different functions operating on

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Alberto Ruiz wrote: The server is working again. On Thursday 07 July 2005 20:58, Alberto Ruiz wrote: I' sorry, our web server is temporarily down :-( http://dis.um.es/~alberto/hmatrix/matrix.html I would remove the 'matrix' portions of the function names, since

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Thu, 7 Jul 2005, Alberto Ruiz wrote: Hello! Thank you very much for all your suggestions. A new version of the library can be found at: http://dis.um.es/~alberto/hmatrix/matrix.html If the Matrix type would be parametrised then Matrix.fromBlocks could use a more natural indexing.

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Thu, 7 Jul 2005, David Roundy wrote: On the other hand, this is sort of a silly debate, since the API *I* want is a subset of the API *you* want. The API you want is certainly not just a subset of what I want. E.g. the singular value decomposition in your favorite API will probably return

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Alberto Ruiz wrote: The server is working again. On Thursday 07 July 2005 20:58, Alberto Ruiz wrote: I' sorry, our web server is temporarily down :-( http://dis.um.es/~alberto/hmatrix/matrix.html I would also prefer a vector of complex numbers for the FFT

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: Henning Thielemann wrote: My objections to making everything a matrix were the objections I sketched for MatLab. The example, again: If you write some common expression like transpose x * a * x Which just goes to show why haskell limits

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: Okay, this approach is starting to make sense to me... I can see now that Vectors are a different type of object to Matrices. Vectors represent points in N-Space and matrices represent operations on those points That's what I wanted to express.

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: Henning Thielemann wrote: Do you mean [x,y,z,1] * [[1,0,0,0],[0,1,0,0],[0,0,1,0],[dx,dy,dz,dw+1]] ? Erm, yes thats what I meant ... but you obviously got the point. but how is this different from adding vectors? If we allow vector addition

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, David Roundy wrote: I don't particularly care what API you use for svd, since it's trivial to convert from one API to the other. It's matrix arithmetic I care about, since that's the complicated part of the API. Of course I want to use the results of more complicated

[Haskell-cafe] Re: matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: Is a matrix is a linear operation on a vector, It _is_ not a linear map, but it is a canonical representation of a linear map. does it not make sense to define matrix applicaion: mapply :: Matrix - Vector - Vector Then you can define say:

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: So the linear operator is translation (ie: + v)... effectively 'plus' could be viewed as a function which takes a vector and returns a matrix (operator) (+) :: Vector - Matrix Since a matrix _is_ not a linear map but only its representation,

Re: [Haskell-cafe] Confused about Cyclic struture

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Dinh Tien Tuan Anh wrote: Another question, it's said in the book that using cyclic structure (like ones = 1:ones) , the list would be represented by a fixed amount of memory. Does it mean [1,1,1..] only occupy one cell of memory ? How about in take 100

[Haskell-cafe] Re: matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: Henning Thielemann wrote: does it not make sense to define matrix applicaion: mapply :: Matrix - Vector - Vector Then you can define say: rotate90 = mapply rotationMatrix90 v' = rotate90 v ... that's what I said about mulVec

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-08 Thread Henning Thielemann
On Fri, 8 Jul 2005, Keean Schupke wrote: Henning Thielemann wrote: On Fri, 8 Jul 2005, Keean Schupke wrote: So the linear operator is translation (ie: + v)... effectively 'plus' could be viewed as a function which takes a vector and returns a matrix (operator) (+) :: Vector

Re: [Haskell-cafe] Interaction in Haskell

2005-07-11 Thread Henning Thielemann
On Mon, 11 Jul 2005, Dinh Tien Tuan Anh wrote: Hi, im using Hugs 98 and learing how to use interactive Haskell. As read in the book: capitalise :: [Char] - [Char] capitalise = takeWhile(/='.') . map toUpper interact capitalise its said the program is FULLY

Re: [Haskell-cafe] a simple function

2005-07-12 Thread Henning Thielemann
On Tue, 12 Jul 2005, wenduan wrote: Anyone please tell me what is wrong with the function: isEmpty ::[a]-Bool isEmpty xs | xs == [] = True |otherwise =False When I tried to load it into the interpreter,it says the following: Could not deduce (Eq a) from the

Re: [Haskell-cafe] matrix computations based on the GSL

2005-07-13 Thread Henning Thielemann
On Wed, 13 Jul 2005, Alberto Ruiz wrote: But now I have two problems: 1) If I define foo :: Vector.T a - Matrix.T a Haddock (version 0.6) shows just this: foo :: T a - T a I don't know how to tell haddock that I want the full names in the signatures. I don't know, too. I'm afraid

[Haskell-cafe] Re: Module.T naming style

2005-07-15 Thread Henning Thielemann
On Thu, 14 Jul 2005, Andrew Pimlott wrote: I would like to bristle mildly against the style of using Vector.T to represent the vector type. The reasons are 1) it is cryptic to those not used to the convention; What does this tell about the quality of the concept? 2) enshrining

Re: [Haskell-cafe] Module.T naming style

2005-07-15 Thread Henning Thielemann
On Fri, 15 Jul 2005, Simon Marlow wrote: On 15 July 2005 09:48, Henning Thielemann wrote: The limit in Haskell is that most compilers don't conform to the Haskell 98 report which allows mutually recursive modules. But I think the compilers should allow them instead of forcing users

[Haskell-cafe] Re: Module.T naming style

2005-07-18 Thread Henning Thielemann
On Fri, 15 Jul 2005, Andrew Pimlott wrote: Even given an ideal implementation (I would add that it should allow multiple modules in one file), Why? I don't find one type or class per module preferable. I think it's usually a false division. It helped me to decide for divisions early.

Re: [Haskell-cafe] Re: Module.T naming style

2005-07-18 Thread Henning Thielemann
On Fri, 15 Jul 2005, John Meacham wrote: I also make sure that the T is a type synonym for the actual name. as in module Vector where data Vector = ... type T = Vector I had to use type synonymes sometimes to avoid mutually recursive modules. It has the disadvantage that a type synonyme

Re: [Haskell-cafe] Proposal: deriving ShallowEq?

2005-07-19 Thread Henning Thielemann
On Tue, 19 Jul 2005, Ben Lippmeier wrote: An example, using some arbitrary data type Thingo: class ShallowEq a where shallowEq :: a - a - Bool data Thingo a b = TOne a | TTwo a b Int Char Float | TThree Int Char b b Questions: 1) Does anyone know a

Re: [Haskell-cafe] file line operation perhaps need loop

2005-07-20 Thread Henning Thielemann
On Wed, 20 Jul 2005, Sun Yi Ming wrote: mix :: [a] - [a] - [a] mix [] ys = ys mix xs [] = xs mix (x:xs) (y:ys) = [x,y] ++ mix xs ys mix xs ys = concat (Data.List.transpose [xs,ys]) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] How to parsing files

2005-07-20 Thread Henning Thielemann
On Wed, 20 Jul 2005, Jake Luck wrote: I need to parse a file in this format: float float float float float float Each row has 3-columns of floating procision number divided by white space. The number of lines is undefined. I use (lines (readFile ...)) to read the file.

Re: [Haskell-cafe] Newbie syntax question

2005-09-19 Thread Henning Thielemann
On Fri, 16 Sep 2005, ChrisK wrote: So I think map ( (flip foo) 5 ) my_list_of_lists_of_doubles Function application is left-associative, so you can save parentheses. map (flip foo 5) my_list_of_lists_of_doubles ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] case of (was: [Haskell] Mixing monadic and non-monadic functions)

2005-09-20 Thread Henning Thielemann
On Mon, 19 Sep 2005, Andrew Pimlott wrote: On Sat, Sep 17, 2005 at 06:56:36PM +0100, Ben Rudiak-Gould wrote: * The new syntax is really nice as a replacement for the annoyingly common x - foo ; case x of... idiom that I've always disliked. I might wish for case of to mean \x - case

Re: [Haskell-cafe] Typing problems with basic arithmetic - help!

2005-09-26 Thread Henning Thielemann
On Fri, 23 Sep 2005, Marcin Tustin wrote: Thanks for this: All I have to do now is fix the fact that my maths is stupidly screwed! 'div' is the integer division and rounds down. You should either use Rational (or Double) everywhere or use % which builds a ratio from two integers.

Re: [Haskell-cafe] Typing problems with basic arithmetic - help!

2005-09-26 Thread Henning Thielemann
On Sat, 24 Sep 2005, Marcin Tustin wrote: For some reason the following code is producing an error message from ghci that the the patterns are non-exhaustive. Does anyone have any idea why that could be, given that the patterns are, at least in my meaning, provably exhaustive?

Re: [Haskell-cafe] how to break foldl' ?

2005-09-30 Thread Henning Thielemann
On Fri, 30 Sep 2005, gary ng wrote: Hi, say if I want to sum a list of numbers but only until it hits a max limit. Currently, I control it through the function and basically do nothing when the max is hit. However, if the list is very long, would this mean the same function would be

Re: [Haskell-cafe] how to break foldl' ?

2005-09-30 Thread Henning Thielemann
On Fri, 30 Sep 2005, gary ng wrote: This should work as expected: takeWhile (maxX) (scanl (+) 0 xs) Thanks. But how would I think about using scanl instead of foldl(or foldl') when I want is the sum, but not the progressive result. Once again show me that I need to throw away all

Re: [Haskell-cafe] how to break foldl' ?

2005-09-30 Thread Henning Thielemann
On Fri, 30 Sep 2005, gary ng wrote: Once again, many thanks to all who taught me about this small little problem. Don't even know there is init/last and thought there is only head/tail. http://www.haskell.org/ghc/docs/6.4/html/libraries/base/Data.List.html But just for my curiosity, would

Re: [Haskell-cafe] Confused about types

2005-10-05 Thread Henning Thielemann
On Fri, 30 Sep 2005, Lanny Ripple wrote: newton_h, next_x_h, dy_h :: (Fractional a, Ord a) = (a - a) - a - a - a newton_h f x h = until ((= h) . abs . f) (next_x_h f h) x If this shall be more than a disposable example, I suggest to separate the Newton iteration from the abort of the

Re: [Haskell-cafe] Zlib bindings

2005-10-18 Thread Henning Thielemann
On Tue, 18 Oct 2005, Joel Reymont wrote: Are there any zlib bindings for Haskell? The docs for HDirect mention the examples directory with the bindings but I cannot find the examples directory in the source distro. Darcs works with gzipped files.

Re: [Haskell-cafe] Vector/matrix arithmetic

2005-11-03 Thread Henning Thielemann
On Wed, 2 Nov 2005, James McNeill wrote: On http://haskell.org/hawiki/FunDeps another approach is sketched out that looks far more appealing to me. This is to create Vector and Matrix types that can use overloaded arithmetic operators. It uses functional dependencies, and the resulting

Re: [Haskell-cafe] Detecting Cycles in Datastructures

2005-11-18 Thread Henning Thielemann
On Fri, 18 Nov 2005, Paul Hudak wrote: For example: fe1,fe2 :: Fix Expr fe1 e = Add (Const 1) (Const 1) -- non-recursive fe2 e = Add (Const 1) e -- recursive Do you mean fe1 _ = Add (Const 1) Loop ? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] records proposals list

2005-11-21 Thread Henning Thielemann
On Sat, 19 Nov 2005, David Roundy wrote: 1. Field namespace issue: Field names should not need to be globally unique. In Haskell 98, they share the function namespace, and must be unique. We either need to make them *not* share the function namespace (which means no getters as functions),

Re: [Haskell-cafe] Records

2005-11-21 Thread Henning Thielemann
On Sat, 19 Nov 2005, 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 also think that it is problematic that a character which can be part of

Re: [Haskell-cafe] Records (was Re: [Haskell] Improvements to GHC)

2005-11-21 Thread Henning Thielemann
On Mon, 21 Nov 2005, Wolfgang Jeltsch wrote: Am Sonntag, 20. November 2005 12:28 schrieb Jesper Louis Andersen: [...] The best argument I can come up with when advocating lines of 80 chars for most programming code is subtle, but important: Code is easier to read for me when it is printed

Re: [Haskell-cafe] Shortening if-then-else

2005-11-22 Thread Henning Thielemann
On Tue, 22 Nov 2005, Matthias Neubauer wrote: Arjan van IJzendoorn [EMAIL PROTECTED] writes: Is there a shorter way to write the if-then-else part below? if (cmdType cmd) /= (CmdSitError Server) then return $ Just seat_num else return Nothing return $ if cmdType

Re: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Henning Thielemann
On Wed, 23 Nov 2005, Udo Stenzel wrote: Scherrer, Chad wrote: Maybe my point wasn't clear. Of course this idea of comparing lazy evaluation to Unix pipes is very old (long before July 2004, I'm sure). The point I'm making is that there is an old idea that may be underused. It is, and only

RE: [Haskell-cafe] Function application like a Unix pipe

2005-11-23 Thread Henning Thielemann
On Wed, 23 Nov 2005, Scherrer, Chad wrote: Henning Thielemann [EMAIL PROTECTED] writes: Since (a . b) x a $ b x a (b x) are equivalent, do you also want to reverse function and argument in order to match argument order of . and $ ? That is x (b . a) x b $ a (x b) a ? I'm

Re: [Haskell-cafe] Hacking Haskell in Nightclubs?

2005-11-30 Thread Henning Thielemann
On Tue, 29 Nov 2005, Paul Hudak wrote: [EMAIL PROTECTED] wrote: Real-time audio is much simpler these days due to SuperCollider, a truly excellent cross platform audio synthesis server by James McCartney. ... OSC messages can be timestamped, and SuperCollider has a sample accurate

Re: [Haskell-cafe] Verbosity of imperative code (was: Learning Haskell)

2005-12-08 Thread Henning Thielemann
On Wed, 7 Dec 2005, J. Garrett Morris wrote: On 12/7/05, Robin Green [EMAIL PROTECTED] wrote: Let's say you want to write a function seqPair :: (Monad m) = (m a, m b) - m (a, b) which returns a computation which does the left computation followed by the right computation (i.e. it's

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mode

2005-12-08 Thread Henning Thielemann
On Thu, 8 Dec 2005, Branimir Maksimovic wrote: program performs search replace on a String http://www.haskell.org/pipermail/haskell-cafe/2005-April/009692.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mo

2005-12-09 Thread Henning Thielemann
On Thu, 8 Dec 2005, Branimir Maksimovic wrote: From: Henning Thielemann [EMAIL PROTECTED] To: Branimir Maksimovic [EMAIL PROTECTED] CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mode Date: Thu, 8 Dec 2005 18:38:45 +0100

Re: [Haskell-cafe] preffered 'map'

2005-12-09 Thread Henning Thielemann
On Fri, 9 Dec 2005, raptor wrote: hi, I imported : import Data.Map as Map but now anywhere when I want ot use map it complains for name clashes, so I have to specifiy Prelude.map all the time. If at all, better use List.map instead of Prelude.map

Re: [Haskell-cafe] Differences in optimisiation with interactive and compiled mode

2005-12-12 Thread Henning Thielemann
On Sat, 10 Dec 2005, Tomasz Zielonka wrote: On Thu, Dec 08, 2005 at 06:38:45PM +0100, Henning Thielemann wrote: On Thu, 8 Dec 2005, Branimir Maksimovic wrote: program performs search replace on a String http://www.haskell.org/pipermail/haskell-cafe/2005-April/009692.html Neat! However

Re: [Haskell-cafe] Differences in optimisiation with interactive and comp

2005-12-12 Thread Henning Thielemann
On Sun, 11 Dec 2005, Branimir Maksimovic wrote: This one is fastest,not much, but is. So here it goes: your version, then Daniel's, then mine. What about a Wiki page containing a searchreplace function competition? :-] ___ Haskell-Cafe mailing

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-12 Thread Henning Thielemann
On Sun, 11 Dec 2005, Tomasz Zielonka wrote: I would like to see some support in tools for enforcing such a coding policy. It could look like this - a function written using only safe components would be marked as safe. Every unsafe feature like FFI, unsafePerformIO, etc. would taint a

Re: [Haskell-cafe] trick to easily generate Eq/Ord instances

2005-12-13 Thread Henning Thielemann
On Mon, 12 Dec 2005, Bulat Ziganshin wrote: Hello sometimes, Eq/Ord classes can't be derived automatically because we need to comare only part of fields. in such situations i use the following trick to easify generation of class instances: data ArchiveBlock = ArchiveBlock {

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Henning Thielemann
On Wed, 21 Dec 2005, Robin Green wrote: Henning Thielemann wrote: Starting with IO in Haskell is like starting LaTeX with rotating text and making it colorful. Not at all! Indeed IO _is_ complicated regardless of whether it is modelled by Monads in Haskell or differently in other

Re: [Haskell-cafe] Re: Tutorial uploaded

2005-12-21 Thread Henning Thielemann
On Wed, 21 Dec 2005, Creighton Hogg wrote: I agree with this wholeheartedly. When I first started playing with Haskell, some of the tutorials made it look like it was very difficult to do anything practical with it because doing real input and output seemed like an advanced topic. The

<    4   5   6   7   8   9   10   11   12   13   >