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
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 -
- 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).
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
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
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.
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
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
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
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
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
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
___
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
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
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
15 matches
Mail list logo