[Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Jon Fairbairn
Cristian Baboi [EMAIL PROTECTED] writes: What I should have been told about upfront: - the syntax for an expression Since there are only declarations and expressions, the syntax of an expression involves pretty much all of the language, so it would be difficult to tell it upfront. - the

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Cristian Baboi
On Tue, 18 Dec 2007 11:56:36 +0200, Jon Fairbairn [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] writes: - the syntax for a block Not sure what you mean by block. do a - [1..10] b - [3,4] return (a,b) is an expression... you can write that same expression as do {a -

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Miguel Mitrofanov
- the lambda expressions can be written (input) but cannot be printed (output) This is a fundamental property of the language. A lambda expression is programme and at runtime the system doesn't know one lambda expression from another (all it can do with one is apply it to something).

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Ketil Malde
Cristian Baboi [EMAIL PROTECTED] writes: I mean anything that you can put between { }, and between ; Okay, there you have it then: the syntax for a block is a {, followed by elements separated by ;s and terminated by a }. Perhaps you are really asking about how the layout rule works? (Which

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Cristian Baboi
On Tue, 18 Dec 2007 12:49:52 +0200, Miguel Mitrofanov [EMAIL PROTECTED] wrote: - the lambda expressions can be written (input) but cannot be printed (output) This is a fundamental property of the language. A lambda expression is programme and at runtime the system doesn't know one

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Miguel Mitrofanov
Yes, and Haskell can do it also. But C, I guess, can't print out a source code for a function (well, there can be some weird dialects of C I'm not aware about). Haskell can't do it either. Well, LISP can, if I remember it right. Only in an interpreter, if I remember it right.

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Ketil Malde
Miguel Mitrofanov [EMAIL PROTECTED] writes: Well, LISP can [print functions], if I remember it right. Only in an interpreter, if I remember it right. I think Emacs used to print #function or something for functions. It seems to keep around the reresentation now. Anyway, LISP has a bunch of

[Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Jon Fairbairn
Cristian Baboi [EMAIL PROTECTED] writes: On Tue, 18 Dec 2007 11:56:36 +0200, Jon Fairbairn [EMAIL PROTECTED] wrote: Cristian Baboi [EMAIL PROTECTED] writes: - the syntax for a block Not sure what you mean by block. do a - [1..10] b - [3,4] return (a,b) is an expression... you

[Haskell-cafe] Re: New to Haskell: The End

2007-12-18 Thread Joost Behrends
Henning Thielemann lemming at henning-thielemann.de writes: - it is lazy with class - it is strongly typed - it has automatic memory management - it has a standard library - it has a compiler - it is available on several platforms - it has a community - it is free There MUST be

[Haskell-cafe] Re: New to Haskell: The End

2007-12-18 Thread apfelmus
Joost Behrends wrote: it has MONADS Interestingly, this is not even a language feature, it just happens that the concept of monads can be expressed in Haskell. (Ok, ignoring syntactic sugar in form of do-notation for the moment. And ignoring that constructor classes have been introduced

Re: [Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-22 Thread Christian Maeder
Keean Schupke wrote: There are problems with this approach... instance (Ord a, Num a) = ApproxEq a where x ~= y = (abs (x-y) 1) However it should do what you want with just -foverlapping-instances -fundecidable-instances. Only -fallow-incoherent-instances allowes to resolve 3.5 ~= 2.6

[Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-22 Thread Christian Maeder
Tomasz Zielonka wrote: Why not forget about ApproxEq for () and Bool and simply define a function? (~=) :: (Ord a, Num a) = a - a - Bool x ~= y = abs (x-y) 1 Indeed, this works best. The instance for lists is also not too important. Christian ___

Re: [Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-22 Thread Daniel Fischer
Am Dienstag, 22. Februar 2005 00:34 schrieb Daniel Fischer: snip That's a very common problem for newbies, so don't panic. In older versions of hugs (November 2002, e.g.), you would have got an unresolved overloading also from entering [] to the prompt (this is no longer so). If such things

Re: [Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-21 Thread Keean Schupke
There are problems with this approach... Instance heads are only chosen by the pattern not the constraints, so: instance (Ord a, Num a) = ApproxEq a where x ~= y = (abs (x-y) 1) Will match any type at all (whether a member of Ord or Num or not) and then will fail if the particular type is not

Re: [Haskell-cafe] Re: New to haskell: unresolved overloading question

2005-02-21 Thread Daniel Fischer
Am Montag, 21. Februar 2005 17:32 schrieb Christian Maeder: Blair Fraser wrote: I'm new to haskell and I'm working through the class section of the gentle tutorial. I decided to implement an ApproxEq class (just for fun), but have run into problems. The code below works fine for units