Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Cristian Baboi wrote:
   http://en.wikipedia.org/wiki/First-class_object
 I'll guess that 5,9,12 does not apply to Haskell functions.

I think there is a basic semantic difference between
what the author of that article meant by the word
function and what we mean by that word when
we are talking about Haskell.

In the article, function means a concrete
data object that specifies how to compute something.

In Haskell, a function is closer to the mathematical
idea of a function. Functions specify relationships between
elements of certain types, and then the compiler
uses them to create code to do your computation.
But there is no obligation for a compiler to create
any concrete data structure that corresponds to
a function. Often it does in practice, but not
always.

On the other hand, functions are members of types
that are just like any other Haskell type. They are
first-class in that sense.

Like any type, only certain operations make
sense on functions. Strings can be compared to each
other for equality and written to a disk, and you
can take the logarithm of a float, but none of those
operations make sense for functions. In particular,
two functions are equal only if they produce
the same value for every input, and in general it is
impossible for a computer to check that.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Sebastian Sylvan
On 12/27/07, Cristian Baboi [EMAIL PROTECTED] wrote:
   http://en.wikipedia.org/wiki/First-class_object

 The term was coined by Christopher Strachey in the context of functions
 as first-class citizens in the mid-1960's.[1]

 Depending on the language, this can imply:
 1.  being expressible as an anonymous literal value
 2.  being storable in variables
 3.  being storable in data structures
 4.  having an intrinsic identity (independent of any given name)
 5.  being comparable for equality with other entities
 6.  being passable as a parameter to a procedure/function
 7.  being returnable as the result of a procedure/function
 8.  being constructable at runtime
 9.  being printable
 10. being readable
 11. being transmissible among distributed processes
 12. being storable outside running processes

 I'll guess that 5,9,12 does not apply to Haskell functions.


I don't think this is meant as a list of requirements, but as examples
of what being first class *can* mean. So yes, in Haskell some of these
points don't make much sense.

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Fwd: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi



--- Forwarded message ---
From: Cristian Baboi [EMAIL PROTECTED]
To: Yitzchak Gale [EMAIL PROTECTED]
Cc:
Subject: Re: [Haskell-cafe] Wikipedia on first-class object
Date: Thu, 27 Dec 2007 12:21:44 +0200

I think I found the answer to why functions cannot be written to files.

This is by design. Haskell must be free.
Enabling writing functions to files, might make it ilegal in some
countries. :-)


On Thu, 27 Dec 2007 11:10:21 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:


Like any type, only certain operations make
sense on functions. Strings can be compared to each
other for equality and written to a disk, and you
can take the logarithm of a float, but none of those
operations make sense for functions. In particular,
two functions are equal only if they produce
the same value for every input, and in general it is
impossible for a computer to check that.

-Yitz


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail  
Servers.

  part000.txt - is OK
http://www.eset.com





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Cristian Baboi wrote:
 I think I found the answer to why functions cannot be written to files.
 This is by design. Haskell must be free.
 Enabling writing functions to files, might make it ilegal in some
 countries. :-)

Ha, excellent!

I imagine that is what Haskell must have been
like before they invented the IO monad. It certainly
was safer then.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: CAF's in Haskell

2007-12-27 Thread Jon Fairbairn
Neil Mitchell [EMAIL PROTECTED] writes:
 I should have been more precise with my question. Given the code:

 fred = 2 + 2

 bob = fred + fred

 In a Haskell implementation fred would be evaluated once to 4, then
 used twice. The 2+2 would only happen once (ignore defaulting and
 overloaded numerics for now).

Not necessarily.  The Haskell 98 standard very carefully
avoids mandating any particular evaluation strategy beyond
that it should be non-strict. So bob is always going to be
8, but just how it gets there is up to the implementation.

If you'd had

fred = [1..]

and 

bob = do something with fred
 a lot of other stuff
 something else with fred

it's much less obvious that keeping the first-calculated
value for fred around the whole time is the right thing to
do.

 Do all Haskell compilers support the sharing.

I don't know all Haskell compilers, but I'm pretty sure
there have been implementations that don't, or don't always
because of the above problem.

-- 
Jón Fairbairn [EMAIL PROTECTED]


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
Thinking about files and types, I recalled that in Pascal files must have  
types.



On Thu, 27 Dec 2007 12:40:22 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:

I'm not sure that in Haskell one can say that storing a value of some  
type

to disk is an operation defined on that type.


It is. For example:

hPutStr :: Handle - String - IO ()

The result type of this function is IO (), which means an
IO action. In this case, the semantics of the action are
that, when performed, it writes the bytes into a file.




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: DSL question -- was: New slogan for haskell.org

2007-12-27 Thread Bjorn Buckwalter
On Dec 26, 2007 10:28 PM, Steve Lihn [EMAIL PROTECTED] wrote:
 arising from use of `/' at DSLTest.hs:11:14-28

 Thanks for the example. I am particularly amazed GHC is complaining at
 '/', not '+'. The type mismatch occurs (is reported) at much lower
 level. It would be nice if there is a way to bump it up a couple
 levels...

I suppose that is how the type inferencer works. To start with all it
really knows is the types of 'phi' and 'mu'. Since it knows the type
of 'mu' it can assume that 'v_GEO' has the same type, and from the
definition of 'v_GEO' (and 'phi') it can infer a type for 'r_GEO'. But
when checking that assumption against the definition of 'r_GEO' which
depends on only 'phi' and 'mu' it realizes that things are amiss. (I'm
just guessing here, the order, or way, in which the compiler does
stuff may be totally different.)

To be fair to the compiler it really has no way of knowing which
definition is wrong without explicit type signatures. As I noted in my
previous reply adding type signatures to all definitions allows the
compiler to locate the error:

  In the second argument of `(+)', namely `mu'
  In the expression: v_GEO + mu

I added this as an example to the library wiki[1]. The version of the
code with type signatures is there and the whole page can be
copy-pasted as literate haskell if you want to try it:

[1] http://code.google.com/p/dimensional/wiki/ErrorMessagesAndDebugging


 On Dec 26, 2007 12:56 PM, Bjorn Buckwalter [EMAIL PROTECTED] wrote:
  Steve Lihn stevelihn at gmail.com writes:
 
   I do come aross a question while reading the DSL page on Wikipedia.
  
   http://en.wikipedia.org/wiki/Domain-specific_programming_language
  
   In the Disadvantage section (near the end), there is an item -- hard
   or impossible to debug. Can anybody explain why or what it means? And
   how does it apply to Haskell?
 
 
  I think I can give a good example of how this can apply to EMBEDDED DSLs. My
  library Dimensional (http://dimensional.googlecode.com) defines what someone
  referred to as a EDSL for working with physical units. The library 
  leverages the
  Haskell type checker to provide static checking of physical dimensions. 
  Without
   doing this I don't know how I could make such checking static.
 
  The downside of this is that while you will be informed at compile time if 
  you
  physical calculations are incorrect the error message itself is rarely 
  useful.
  Here is an example with lines numbered:
 
   1 import Numeric.Units.Dimensional.Prelude
   2 import qualified Prelude
   3
   4 -- The angular velocity of Earth's rotation (Soop p. 7).
   5 phi = 360.985647 *~ (degree / day)
   6
   7 -- The gravitational parameter of Earth.
   8 mu = 3.98600448003e14 *~ (meter ^ pos3 / second ^ pos2)
   9
   10 -- The ideal geostationary radius and velocity.
   11 r_GEO = cbrt (mu / phi ^ pos2)
   12 v_GEO = phi * r_GEO
   13
   14 -- Something obviously wrong.
   15 dont_try_this_at_home = v_GEO + mu
 
  Obviously we shouldn't be adding a velocity to a gravitational parameter on 
  line
  15 and the compiler will catch this. However, this is the error message from
  GHCi (6.6.1):
 
  DSLTest.hs:1:0:
 Couldn't match expected type `Numeric.NumType.Neg n'
against inferred type `Numeric.NumType.Zero'
 When using functional dependencies to combine
   Numeric.NumType.Sub a Numeric.NumType.Zero a,
 arising from the instance declaration at Defined in Numeric.NumType
   Numeric.NumType.Sub Numeric.NumType.Zero
   Numeric.NumType.Zero
   (Numeric.NumType.Neg n),
 arising from use of `/' at DSLTest.hs:11:14-28
 
  I think you will agree that this isn't very helpful in pin-pointing the 
  problem.
  The compiler is pointing at the definition of 'r_GEO' which is twice removed
  from the actual offender. Stuff like this can make EDSLs difficult to debug.
 
  (In this particular example adding type signatures to all definitions will 
  allow
  the compiler to pin-point the error to line 15, although the error message
  remains cryptic.)
 
  Hope that helps,
  Bjorn
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Cristian Baboi wrote:
 Ah! You must have been thinking that function in Haskell are members of
 DATA types.
 Or, to put it another way, Haskell make no distinction between data types
 and function types.

Yes.

I wrote:
 Like any type, only certain operations make
 sense on functions...

 Yes, but one can store the result of an operation to disk except in the
 particular case the result happen to be a function.

 No, you can only store the result of an operation to
 disk in the particular case that the result type represents
 a list of bytes. Otherwise, you have to serialize it first...
 But it is not clear at all how you could define a general
 serialization method for functions.

 Isn't that confusing levels of abstractions ?
 Of course functions are bytes, 'cause they are already stored as bytes in
 RAM.

That is just the point. A function in Haskell is an abstraction,
not bytes in RAM.

The compiler might implement the same function in several places,
with different bytes in each place. Or it might decide to combine it
into other functions, and not store any bytes in RAM at all for this
function.

The function itself represents a way of doing a calculation. It is not an
object that can do the calculation.

 I'm not sure that in Haskell one can say that storing a value
 of some type to disk is an operation defined on that type.

 It is. For example:
 hPutStr :: Handle - String - IO ()

 And this is a property of the type String ?
 The function hPutStr appears in the definition of the type String ?

Ah, you are thinking of operation on a type in the OOP sense.
Sorry, I wasn't clear. When I said only certain operations make
sense on each type, I just meant that there are only certain
things you can do with the type. In Haskell, the things you can
do with a type are the functions you can define that mention that
type in their signature.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi

On Thu, 27 Dec 2007 14:37:51 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:


I wrote:

Like any type, only certain operations make
sense on functions...


Yes, but one can store the result of an operation to disk except in  
the

particular case the result happen to be a function.



No, you can only store the result of an operation to
disk in the particular case that the result type represents
a list of bytes. Otherwise, you have to serialize it first...
But it is not clear at all how you could define a general
serialization method for functions.



Isn't that confusing levels of abstractions ?
Of course functions are bytes, 'cause they are already stored as bytes  
in

RAM.


That is just the point. A function in Haskell is an abstraction,
not bytes in RAM.

The compiler might implement the same function in several places,
with different bytes in each place. Or it might decide to combine it
into other functions, and not store any bytes in RAM at all for this
function.

The function itself represents a way of doing a calculation. It is not an
object that can do the calculation.



I think you try to say that the time cannot be stored.



 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi

On Thu, 27 Dec 2007 14:37:51 +0200, Yitzchak Gale [EMAIL PROTECTED] wrote:



I wrote:

Like any type, only certain operations make
sense on functions...


Yes, but one can store the result of an operation to disk except in  
the

particular case the result happen to be a function.



No, you can only store the result of an operation to
disk in the particular case that the result type represents
a list of bytes. Otherwise, you have to serialize it first...
But it is not clear at all how you could define a general
serialization method for functions.



Isn't that confusing levels of abstractions ?
Of course functions are bytes, 'cause they are already stored as bytes  
in

RAM.



That is just the point. A function in Haskell is an abstraction,
not bytes in RAM.



The compiler might IMPLEMENT the same function in several places,
with different bytes in each place. Or it might decide to combine it
into other functions, and not store any bytes in RAM at all for this
function.


See ?


The function itself represents a way of doing a calculation. It is not an
object that can do the calculation.


Then trees of functions are ...


I'm not sure that in Haskell one can say that storing a value
of some type to disk is an operation defined on that type.



It is. For example:
hPutStr :: Handle - String - IO ()



And this is a property of the type String ?
The function hPutStr appears in the definition of the type String ?



Ah, you are thinking of operation on a type in the OOP sense.
Sorry, I wasn't clear. When I said only certain operations make
sense on each type, I just meant that there are only certain
things you can do with the type. In Haskell, the things you can
do with a type are the functions you can define that mention that
type in their signature.


How can one define in the language STORAGE of things ?
Storage of numbers for example ?
You said that the TYPE of a function forbids me somehow to store it in a  
file.
Now I understand that not the type forbids me, but the lack of a function  
with apropriate types.






 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Bulat Ziganshin
Hello Yitzchak,

Thursday, December 27, 2007, 12:10:21 PM, you wrote:

   http://en.wikipedia.org/wiki/First-class_object
 I'll guess that 5,9,12 does not apply to Haskell functions.

you mean 5, 9-12?

 In particular,
 two functions are equal only if they produce
 the same value for every input, and in general it is
 impossible for a computer to check that.

for a computer is superfluous here. people are not smarter than
computers and can't do anything that's impossible for computers


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Comparing functions is certainly possible in Haskell, but there's no
standard function that does it.
If course, it might not terminate, but the same is true for many other
comparable objects in Haskell, e.g., infinite lists (which are  
isomorphic to

Nat-T).


The list [1 .. ] is a single value in Haskell ?




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[4]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Bulat Ziganshin
Hello Cristian,

Thursday, December 27, 2007, 3:51:17 PM, you wrote:

 Yes, but one can store the result of an operation to disk except in the
 particular case the result happen to be a function.

 how can values of type T be saved to disk?

 I don't know.
 I'm a beginner in Haskell, and I down't know about T.

here T is any type. you said that values of ANY TYPE can be saved to
disk, so show us the way

 You mean they cannot ?
 I was under the impression that the purpose of computers cannot be  
 fulfiled if we cannot get the result of computations out of the computers.

try to prove that this mean that value of ANY type may be saved to
disk


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Fwd: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi


How about x below:

let x=(1:x) in x ?

Is x a single value in Haskell ?

--- Forwarded message ---
From: Cristian Baboi [EMAIL PROTECTED]
To: Lennart Augustsson [EMAIL PROTECTED]
Cc: haskell-cafe@haskell.org haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Wikipedia on first-class object
Date: Thu, 27 Dec 2007 16:08:58 +0200

On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson
[EMAIL PROTECTED] wrote:


Comparing functions is certainly possible in Haskell, but there's no
standard function that does it.
If course, it might not terminate, but the same is true for many other
comparable objects in Haskell, e.g., infinite lists (which are  
isomorphic to

Nat-T).


The list [1 .. ] is a single value in Haskell ?




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Lennart Augustsson
Absolutly.  Every expression in Haskell denotes a value.
Now, we've not agreed what value means, but to me it is a value. :)

  -- Lennart

On Dec 27, 2007 3:28 PM, Cristian Baboi [EMAIL PROTECTED] wrote:


 How about x below:

 let x=(1:x) in x ?

 Is x a single value in Haskell ?

 --- Forwarded message ---
 From: Cristian Baboi [EMAIL PROTECTED]
 To: Lennart Augustsson [EMAIL PROTECTED]
 Cc: haskell-cafe@haskell.org haskell-cafe@haskell.org
 Subject: Re: [Haskell-cafe] Wikipedia on first-class object
 Date: Thu, 27 Dec 2007 16:08:58 +0200

 On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson
 [EMAIL PROTECTED] wrote:

  Comparing functions is certainly possible in Haskell, but there's no
  standard function that does it.
  If course, it might not terminate, but the same is true for many other
  comparable objects in Haskell, e.g., infinite lists (which are
  isomorphic to
  Nat-T).

 The list [1 .. ] is a single value in Haskell ?




  Information from NOD32 
 This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
 http://www.eset.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A Foldable binary search tree

2007-12-27 Thread Jules Bean

Simon Peyton-Jones wrote:

As others have pointed out, GHC allows you to put a context on any data constructor.  I 
prefer this where syntax:


But, in 6.8.x, you will need -XGADTS to permit this.

6.6.x permitted it anyway, arguably in error.

http://hackage.haskell.org/trac/ghc/ticket/1901

Jules
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 14:42:37 +0200, Bulat Ziganshin  
[EMAIL PROTECTED] wrote:



Hello Cristian,

Thursday, December 27, 2007, 12:19:08 PM, you wrote:


Yes, but one can store the result of an operation to disk except in the
particular case the result happen to be a function.



how can values of type T be saved to disk?


I don't know. I'm a beginner in Haskell, and I down't know about T.
You mean they cannot ?
I was under the impression that the purpose of computers cannot be  
fulfiled if we cannot get the result of computations out of the computers.







 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 6:51 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 14:42:37 +0200, Bulat Ziganshin  
[EMAIL PROTECTED] wrote:



Hello Cristian,

Thursday, December 27, 2007, 12:19:08 PM, you wrote:

Yes, but one can store the result of an operation to disk except  
in the

particular case the result happen to be a function.



how can values of type T be saved to disk?


I don't know. I'm a beginner in Haskell, and I down't know about T.
You mean they cannot ?
I was under the impression that the purpose of computers cannot be  
fulfiled if we cannot get the result of computations out of the  
computers.


Haskell is not a computer programming language; Haskell  
implementations are not required to run on computers.  Haskell is a  
formal notation for computation (completely unrelated to the Von  
Neuman machine sitting on your desk).  It can be implemented on Von  
Neuman machines, because they are still universal Turing machines,  
but it is /not/ a radical attack on the problem of programming  
peripherals!


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
Good to know. I intended to use Haskell for algorithms, but it seems it is  
not so good at them.



On Thu, 27 Dec 2007 17:52:19 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:



On 27 Dec 2007, at 9:47 AM, Cristian Baboi wrote:





I don't know. I'm a beginner in Haskell, and I down't know about T.
You mean they cannot ?
I was under the impression that the purpose of computers cannot be  
fulfiled if we cannot get the result of computations out of the  
computers.


Haskell is not a computer programming language; Haskell  
implementations are not required to run on computers.  Haskell is a  
formal notation for computation (completely unrelated to the Von  
Neuman machine sitting on your desk).  It can be implemented on Von  
Neuman machines, because they are still universal Turing machines,  
but it is /not/ a radical attack on the problem of programming  
peripherals!


I suppose it can run on pebbles.


Any language can be emulated on pebbles; unlike most languages,  
Haskell can be compiled directly to them.


jcc


I know, and in this case one doesn't need IO.
The result is a nice collection of asorted pebbles.


Which is why Haskell treats IO as a domain specific language.

jcc





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 4:57 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 12:40:22 +0200, Yitzchak Gale [EMAIL PROTECTED]  
wrote:



I wrote:

On the other hand, functions are members of types
that are just like any other Haskell type. They are
first-class in that sense.


Cristian Baboi wrote:

I guess that would apply to any typed language.



Perhaps. But for many typed languages, it is not
practical to use. There may be problems with type
safety, or it may create a program that would
be considered hard to understand.

For example, in Haskell, you create a list of functions just
the same way you create a list of anything else.
You can then map a value across the functions, or
fold the functions together with the composition
operator, etc. These are normal, clear idioms
in Haskell that could easily appear in any simple
program. That is also true for some other functional
programming languages, but it is rare for
imperative ones.

Sometimes there is a particular style within a language
that works something like this. For example,
you can use C++ with STL that way in a certain sense.



Anyway, that is what I think it means when we say that
functions are first-class in Haskell.


Ah! You must have been thinking that function in Haskell are  
members of DATA types.
Or, to put it another way, Haskell make no distinction between data  
types and function types.



Like any type, only certain operations make
sense on functions. Strings can be compared to each
other for equality and written to a disk, and you
can take the logarithm of a float, but none of those
operations make sense for functions. In particular,
two functions are equal only if they produce
the same value for every input, and in general it is
impossible for a computer to check that.


Yes, but one can store the result of an operation to disk except  
in the

particular case the result happen to be a function.



No, you can only store the result of an operation to
disk in the particular case that the result type represents
a list of bytes. Otherwise, you have to serialize it first.


Happily, Haskell has some cool tools for easily creating  
serialization

methods. And there are a number methods that are already
provided in the libraries for many types and for many
uses - the Read and Show classes are just one example.



But it is not clear at all how you could define a general
serialization method for functions. If you can come up
with one, please post it to Hackage. :)


Isn't that confusing levels of abstractions ?
Of course functions are bytes, 'cause they are already stored as  
bytes in RAM.


Only on Von Neuman machines.  Haskell implementations are not  
required to run on Von Neuman machines.  That's why the language is  
called functional.  (Imperative languages, by contrast, are just  
abstractions of the underlying Von Neuman architecture, which is  
probably the source of your confusion).


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Absolutly.  Every expression in Haskell denotes a value.
Now, we've not agreed what value means, but to me it is a value. :)


It is one value, or several ?


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Lennart Augustsson
One value.  One infinite value.

On Dec 27, 2007 3:53 PM, Cristian Baboi [EMAIL PROTECTED] wrote:

 On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson
 [EMAIL PROTECTED] wrote:

  Absolutly.  Every expression in Haskell denotes a value.
  Now, we've not agreed what value means, but to me it is a value. :)

 It is one value, or several ?


  Information from NOD32 
 This message was checked by NOD32 Antivirus System for Linux Mail Servers.
  part000.txt - is OK
 http://www.eset.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[4]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 16:12:04 +0200, Bulat Ziganshin  
[EMAIL PROTECTED] wrote:



Hello Cristian,

Thursday, December 27, 2007, 3:51:17 PM, you wrote:

Yes, but one can store the result of an operation to disk except in  
the

particular case the result happen to be a function.



how can values of type T be saved to disk?



I don't know.
I'm a beginner in Haskell, and I down't know about T.



here T is any type. you said that values of ANY TYPE can be saved to
disk, so show us the way


The way is toward west.

I said except functions. I'll add instances of IO.



 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Wolfgang Jeltsch
Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:
 I'll have to trust you, because I cannot test it.

 let x=(1:x); y=(1:y) in x==y .

 I also cannot test this:

 let x=(1:x); y=1:1:y in x==y

In these examples, x and y denote the same value but the result of x == y is 
_|_ (undefined) in both cases.  So (==) is not really equality in Haskell but 
a kind of weak equality: If x doesn’t equal y, x == y is False, but if x 
equals y, x == y might be True or undefined.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi

I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y





On Thu, 27 Dec 2007 17:29:12 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



One value.  One infinite value.

On Dec 27, 2007 3:53 PM, Cristian Baboi [EMAIL PROTECTED] wrote:


On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson
[EMAIL PROTECTED] wrote:

 Absolutly.  Every expression in Haskell denotes a value.
 Now, we've not agreed what value means, but to me it is a value. :)

It is one value, or several ?


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail  
Servers.

 part000.txt - is OK
http://www.eset.com





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail  
Servers.

  part000.txt - is OK
  part001.htm - is OK
http://www.eset.com





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi




I don't know. I'm a beginner in Haskell, and I down't know about T.
You mean they cannot ?
I was under the impression that the purpose of computers cannot be  
fulfiled if we cannot get the result of computations out of the  
computers.


Haskell is not a computer programming language; Haskell  
implementations are not required to run on computers.  Haskell is a  
formal notation for computation (completely unrelated to the Von  
Neuman machine sitting on your desk).  It can be implemented on Von  
Neuman machines, because they are still universal Turing machines, but  
it is /not/ a radical attack on the problem of programming peripherals!


I suppose it can run on pebbles.


Any language can be emulated on pebbles; unlike most languages, Haskell  
can be compiled directly to them.


jcc


I know, and in this case one doesn't need IO.
The result is a nice collection of asorted pebbles.



 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 9:41 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 17:39:25 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:



On 27 Dec 2007, at 6:51 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 14:42:37 +0200, Bulat Ziganshin  
[EMAIL PROTECTED] wrote:



Hello Cristian,

Thursday, December 27, 2007, 12:19:08 PM, you wrote:

Yes, but one can store the result of an operation to disk  
except in the

particular case the result happen to be a function.



how can values of type T be saved to disk?


I don't know. I'm a beginner in Haskell, and I down't know about T.
You mean they cannot ?
I was under the impression that the purpose of computers cannot  
be fulfiled if we cannot get the result of computations out of  
the computers.


Haskell is not a computer programming language; Haskell  
implementations are not required to run on computers.  Haskell is  
a formal notation for computation (completely unrelated to the Von  
Neuman machine sitting on your desk).  It can be implemented on  
Von Neuman machines, because they are still universal Turing  
machines, but it is /not/ a radical attack on the problem of  
programming peripherals!


I suppose it can run on pebbles.


Any language can be emulated on pebbles; unlike most languages,  
Haskell can be compiled directly to them.


jcc


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:53 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Absolutly.  Every expression in Haskell denotes a value.
Now, we've not agreed what value means, but to me it is a value. :)


It is one value, or several ?


It is one and the same value, now and for ever, and in every  
incarnation on every Haskell machine.


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:08 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 14:02:36 +0200, Lennart Augustsson  
[EMAIL PROTECTED] wrote:



Comparing functions is certainly possible in Haskell, but there's no
standard function that does it.
If course, it might not terminate, but the same is true for many  
other
comparable objects in Haskell, e.g., infinite lists (which are  
isomorphic to

Nat-T).


The list [1 .. ] is a single value in Haskell ?


Yes.  Of course.

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:28 AM, Cristian Baboi wrote:



How about x below:

let x=(1:x) in x ?

Is x a single value in Haskell ?


(let x=1:x in x) is.  x went out of scope a couple of lines back.

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 17:39:25 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:



On 27 Dec 2007, at 6:51 AM, Cristian Baboi wrote:

On Thu, 27 Dec 2007 14:42:37 +0200, Bulat Ziganshin  
[EMAIL PROTECTED] wrote:



Hello Cristian,

Thursday, December 27, 2007, 12:19:08 PM, you wrote:

Yes, but one can store the result of an operation to disk except in  
the

particular case the result happen to be a function.



how can values of type T be saved to disk?


I don't know. I'm a beginner in Haskell, and I down't know about T.
You mean they cannot ?
I was under the impression that the purpose of computers cannot be  
fulfiled if we cannot get the result of computations out of the  
computers.


Haskell is not a computer programming language; Haskell implementations  
are not required to run on computers.  Haskell is a formal notation for  
computation (completely unrelated to the Von Neuman machine sitting on  
your desk).  It can be implemented on Von Neuman machines, because they  
are still universal Turing machines, but it is /not/ a radical attack on  
the problem of programming peripherals!


I suppose it can run on pebbles.


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 9:34 AM, Cristian Baboi wrote:


I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y


Correct.  You could try proving it.

Or you could try proving that these expressions are equal to _|_.   
Equality is defined on lists because we frequently use finite lists,  
where it makes sense.  Infinite lists are more like functions ---  
useful in the intermediate stages of computation, but really  
orthogonal to everything you think you know about computing.


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 9:47 AM, Cristian Baboi wrote:





I don't know. I'm a beginner in Haskell, and I down't know  
about T.

You mean they cannot ?
I was under the impression that the purpose of computers cannot  
be fulfiled if we cannot get the result of computations out of  
the computers.


Haskell is not a computer programming language; Haskell  
implementations are not required to run on computers.  Haskell  
is a formal notation for computation (completely unrelated to  
the Von Neuman machine sitting on your desk).  It can be  
implemented on Von Neuman machines, because they are still  
universal Turing machines, but it is /not/ a radical attack on  
the problem of programming peripherals!


I suppose it can run on pebbles.


Any language can be emulated on pebbles; unlike most languages,  
Haskell can be compiled directly to them.


jcc


I know, and in this case one doesn't need IO.
The result is a nice collection of asorted pebbles.


Which is why Haskell treats IO as a domain specific language.

jcc


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Wolfgang Jeltsch
Am Donnerstag, 27. Dezember 2007 16:57 schrieb Cristian Baboi:
 On Thu, 27 Dec 2007 17:52:19 +0200, Jonathan Cast
  Which is why Haskell treats IO as a domain specific language.

 Good to know. I intended to use Haskell for algorithms, but it seems it is
 not so good at them.

Why is I/O needed for algorithms?

And the fact that I/O is embedded into Haskell as a kind of a domain specific 
language doesn’t mean that Haskell is bad at I/O.  As Simon Peyton Jones put 
it: Haskell is the world’s finest imperative programming language.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Bulat Ziganshin
Hello Cristian,

Thursday, December 27, 2007, 12:19:08 PM, you wrote:

 Yes, but one can store the result of an operation to disk except in the
 particular case the result happen to be a function.

how can values of type T be saved to disk?


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Wolfgang Jeltsch
Am Donnerstag, 27. Dezember 2007 15:53 schrieb Cristian Baboi:
 On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson

 [EMAIL PROTECTED] wrote:
  Absolutly.  Every expression in Haskell denotes a value.
  Now, we've not agreed what value means, but to me it is a value. :)

 It is one value, or several ?

It is one value with parts that are values themselves.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 9:57 AM, Cristian Baboi wrote:

Good to know. I intended to use Haskell for algorithms, but it  
seems it is not so good at them.


Very sad.  The entire point of Haskell is that it allows the user to  
transcend the algorithm as a way of expressing computations.


I hope someday you may understand Haskell, rather than just  
criticizing it.


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Achim Schneider
Wolfgang Jeltsch [EMAIL PROTECTED] wrote:

 Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:
 I'll have to trust you, because I cannot test it.

 let x=(1:x); y=(1:y) in x==y .

 I also cannot test this:

 let x=(1:x); y=1:1:y in x==y
 
 In these examples, x and y denote the same value but the result of x
 == y is _|_ (undefined) in both cases.  So (==) is not really
 equality in Haskell but a kind of weak equality: If x doesn’t equal
 y, x == y is False, but if x equals y, x == y might be True or
 undefined.

[1..] == [1..] certainly isn't undefined, it always evaluates to True,
just like [2..] == [2..]. It just takes ghci eternity to prove, as its
runtime system doesn't even think of trying to put the axiom
forall n: if x == y then x + n == y + n
together with its knowledge about the equal stepping of the lists and
short-circuit to True.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 10:44 AM, Achim Schneider wrote:


Wolfgang Jeltsch [EMAIL PROTECTED] wrote:


Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:

I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y


In these examples, x and y denote the same value but the result of x
== y is _|_ (undefined) in both cases.  So (==) is not really
equality in Haskell but a kind of weak equality: If x doesn’t equal
y, x == y is False, but if x equals y, x == y might be True or
undefined.


[1..] == [1..] certainly isn't undefined, it always evaluates to True,


If something happens, it does eventually happen.

More importantly, we can prove that [1..] == [1..] = _|_, since

  [1..] == [1..]
= LUB (n = 1) [1..n] ++ _|_ == [1..n] ++ _|_
= LUB (n = 1) _|_
= _|_

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread apfelmus

Wolfgang Jeltsch wrote:
If x doesn’t equal y, x == y is False, but if x 
equals y, x == y might be True or undefined.


x == y  may be _|_ for the False case, too, depending on its 
implementation (like first comparing all list elements on even indices 
and then comparing all list elements on odd indices). But the standard 
== for lists has indeed the stated property.



Regards,
apfelmus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Doing some things right

2007-12-27 Thread Don Stewart
A Wake Up Call for the Logic Programming Community

Or what the logic programming community can learn from the Haskell
community (in particular):


http://www.cs.kuleuven.ac.be/%7Edtai/projects/ALP//newsletter/dec07/content/Articles/tom/content.html

Interesting read!

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Achim Schneider
Jonathan Cast [EMAIL PROTECTED] wrote:

 On 27 Dec 2007, at 10:44 AM, Achim Schneider wrote:
 
  Wolfgang Jeltsch [EMAIL PROTECTED] wrote:
 
  Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:
  I'll have to trust you, because I cannot test it.
 
  let x=(1:x); y=(1:y) in x==y .
 
  I also cannot test this:
 
  let x=(1:x); y=1:1:y in x==y
 
  In these examples, x and y denote the same value but the result of
  x == y is _|_ (undefined) in both cases.  So (==) is not really
  equality in Haskell but a kind of weak equality: If x doesn’t equal
  y, x == y is False, but if x equals y, x == y might be True or
  undefined.
 
  [1..] == [1..] certainly isn't undefined, it always evaluates to
  True,
 
 If something happens, it does eventually happen.
 
 More importantly, we can prove that [1..] == [1..] = _|_, since
 
[1..] == [1..]
 = LUB (n = 1) [1..n] ++ _|_ == [1..n] ++ _|_
 = LUB (n = 1) _|_
 = _|_
 
As far as I understand
http://www.haskell.org/haskellwiki/Bottom
, only computations which cannot be successful are bottom, not those
that can be successful, but aren't. Kind of idealizing reality, that is.

Confusion of computations vs. reductions and whether time exists or
not is included for free here. Actually, modulo mere words, I accept
both your and my argument as true, but prefer mine.

You _do_ accept that you won't ever see Prelude.undefined in ghci
when evaluating
let x=(1:x); y=(1:y) in x==y
, and there won't ever be a False in the chain of 's, don't you?

The question arises, which value is left from the possible values of
Bool when you take away False and _|_?

And now don't you dare to say that _|_ /= undefined.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread apfelmus

Achim Schneider wrote:

Jonathan Cast wrote:

More importantly, we can prove that [1..] == [1..] = _|_, since

   [1..] == [1..]
= LUB (n = 1) [1..n] ++ _|_ == [1..n] ++ _|_
= LUB (n = 1) _|_
= _|_


As far as I understand
http://www.haskell.org/haskellwiki/Bottom
, only computations which cannot be successful are bottom, not those
that can be successful, but aren't. Kind of idealizing reality, that is.


Ah, that's only a glitch in the wording. [1..] == [1..] is still _|_ 
since it loops forever.


For more about _|_, see also

  http://en.wikibooks.org/wiki/Haskell/Denotational_semantics


Regards,
apfelmus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 12:20 PM, Achim Schneider wrote:


Jonathan Cast [EMAIL PROTECTED] wrote:


On 27 Dec 2007, at 10:44 AM, Achim Schneider wrote:


Wolfgang Jeltsch [EMAIL PROTECTED] wrote:


Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:

I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y


In these examples, x and y denote the same value but the result of
x == y is _|_ (undefined) in both cases.  So (==) is not really
equality in Haskell but a kind of weak equality: If x doesn’t equal
y, x == y is False, but if x equals y, x == y might be True or
undefined.


[1..] == [1..] certainly isn't undefined, it always evaluates to
True,


If something happens, it does eventually happen.

More importantly, we can prove that [1..] == [1..] = _|_, since

   [1..] == [1..]
= LUB (n = 1) [1..n] ++ _|_ == [1..n] ++ _|_
= LUB (n = 1) _|_
= _|_


As far as I understand
http://www.haskell.org/haskellwiki/Bottom
, only computations which cannot be successful are bottom, not those
that can be successful, but aren't.


Um, no.  Haskell has no formal denotational semantics, but everyone  
knows what it should be.  And _|_ is a polymorphic value in that  
domain.  _|_ is the denotation of every Haskell expression whose  
denotation is _|_.



Kind of idealizing reality, that is.

Confusion of computations vs. reductions


In Haskell, these are the same thing (modulo IO).


and whether time exists or
not is included for free here. Actually, modulo mere words, I accept
both your and my argument as true


Huh?


, but prefer mine.


Preference doesn't come into it.  By definition, the denotations of  
Haskell functions are monotone continous functions on pointed  
complete partial orders.



You _do_ accept that you won't ever see Prelude.undefined in ghci
when evaluating
let x=(1:x); y=(1:y) in x==y


Huh?


, and there won't ever be a False in the chain of 's, don't you?


Huh?


The question arises, which value is left from the possible values of
Bool when you take away False and _|_?


Why take away _|_?


And now don't you dare to say that _|_ /= undefined.


undefined is one of many Haskell expressions that has _|_ as a  
denotation.  It is not a normal form, certainly, but that's ok.


You seem to think that _|_ is defined in terms of operational  
semantics.  Haskell hasn't got an operational semantics, just a  
denotational semantics that implementations must produce an  
operational semantics to match with.  _|_ is a denotational idea,  
defined in terms of partial orders and least upper bounds.  An  
infinite list is the least upper bound of an infinite set of partial  
lists, and the value of any function (such as \x - x == x) applied  
to it is the least upper bound of the values of that function applied  
to those partial lists.


By definition.

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Yitzchak Gale
Wolfgang Jeltsch wrote:
 If x doesn't equal y, x == y is False, but if x
 equals y, x == y might be True or undefined.

apfelmus wrote:
 x == y  may be _|_ for the False case, too, depending on its
 implementation (like first comparing all list elements on even indices
 and then comparing all list elements on odd indices). But the standard
 == for lists has indeed the stated property.

[undefined] doesn't equal [1] but  [undefined]==[1] is _|_, not False.

-Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Isaac Dupree

Bulat Ziganshin wrote:

here T is any type. you said that values of ANY TYPE can be saved to
disk, so show us the way


...


try to prove that this mean that value of ANY type may be saved to
disk


Run another program that uses lots of memory, and watch the entire 
Haskell program's memory be swapped out to disk.  Better yet, 
suspend-to-disk (or hibernate) your computer.  Voila -- values of any 
and all types have been saved to disk!  In a limited fashion, of course.


Isaac

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Dynamic typing of polymorphic functions

2007-12-27 Thread Ben Franksen
Alfonso Acosta wrote:
 2) Think of a change in the internal representation of signals which
 made polymorphic processes possible. Polymorphic processes don't have
 to
 be necessarily definable by the user. They should be happy enough
 with a few polymorphic primitives (mapSnd would be one of them).

I am not sure if this is applicable to your problem, but in GHC you can wrap
polymorphic values in a newtype using higher-rank polymorphism, like in

newtype WrapId = WrapId { unWrapId :: (forall a. a - a) } deriving Typeable

You can then use

  toDyn . WrapId

to wrap 'id' into a Dynamic and

  unWrapId . flip fromDyn (error wrong type)

to unwrap it.

Cheers
Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Achim Schneider
Jonathan Cast [EMAIL PROTECTED] wrote:

 _|_ is the denotation of every Haskell expression whose  
 denotation is _|_.

Mu.

 Why take away _|_?
 
Because, when zenning about

instance (Eq a) = Eq [a] where
[] == [] = True
(x:xs) == (y:ys) = x == y  xs == ys
_xs== _ys= False

and 

[n..] == [m..], 

the first thing I notice is

n == m  n+1 == m+1

, which already expresses all of infinity in one instance and can be
trivially cancelled to

n == m

, which makes the whole darn thing only _|_ if n or m is _|_, which no
member of [n..] can be as long as n isn't or 1 or + has funny ideas.

I finally begin to understand my love and hate relationship with
formalisms: It involves cuddling with fixed points while protecting
them from evil data and fixed points they don't like as well as
reduction strategies that don't see their full beauty.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 4:54 PM, Achim Schneider wrote:


Jonathan Cast [EMAIL PROTECTED] wrote:


_|_ is the denotation of every Haskell expression whose
denotation is _|_.


Mu.


Why take away _|_?


Because, when zenning about

instance (Eq a) = Eq [a] where
[] == [] = True
(x:xs) == (y:ys) = x == y  xs == ys
_xs== _ys= False

and

[n..] == [m..],

the first thing I notice is

n == m  n+1 == m+1

, which already expresses all of infinity in one instance and can be
trivially cancelled to


Danger, Will Robinson!

Cancellation derives from valid equations, it does not lead to them.   
(x^2 - 1)/(x - 1) /= 2 when x = 1, however many times you cancel it.



n == m

, which makes the whole darn thing only _|_ if n or m is _|_, which no
member of [n..] can be as long as n isn't or 1 or + has funny ideas.

I finally begin to understand my love and hate relationship with
formalisms: It involves cuddling with fixed points while protecting
them from evil data and fixed points they don't like as well as
reduction strategies that don't see their full beauty.


Love formalisms or hate them as much as you want.

They still define Haskell's semantics.

jcc


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ambiguous types although 'asTypeOf'

2007-12-27 Thread Henning Thielemann

On Tue, 25 Dec 2007, Felipe Lessa wrote:

 On Dec 25, 2007 4:27 PM, Henning Thielemann
 [EMAIL PROTECTED] wrote:
  test :: (Integral a, RealFrac a) = a
  test =
 let c = undefined
 in  asTypeOf (round c) c
 
 
  When compiling I get:
 
  Compiling StorableInstance ( src/StorableInstance.hs, interpreted )
 
  src/StorableInstance.hs:38:17:
  Warning: Defaulting the following constraint(s) to type `Double'
   `RealFrac a' arising from use of `round' at 
  src/StorableInstance.hs:38:17-21
   In the first argument of `asTypeOf', namely `(round c)'
   In the definition of `test1': test1 = let c = undefined in 
  asTypeOf (round c) c

 Interesting, I don't see this behaviour at all.

Of course, I use -Wall all the time. :-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell-cafe reply-to etiquette

2007-12-27 Thread Tom Phoenix
On Dec 27, 2007 3:36 PM, Justin Bailey [EMAIL PROTECTED] wrote:

 When I joined the haskell-cafe mailing list, I was surprised to see
 the reply-to header on each message was set to the sender of a given
 message to the list, rather than the list itself. That seemed counter
 to other mailing lists I had been subscribed to, but I didn't think
 too much about it.

http://www.unicom.com/pw/reply-to-harmful.html

Cheers!

--Tom Phoenix
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell-cafe reply-to etiquette

2007-12-27 Thread Lutz Donnerhacke
* Justin Bailey wrote:
 When I joined the haskell-cafe mailing list, I was surprised to see
 the reply-to header on each message was set to the sender of a given
 message to the list, rather than the list itself.

That's good practice.

 That seemed counter to other mailing lists I had been subscribed to, but
 I didn't think too much about it.

Please search for Reply-To considered harmful and send this text to the
admins of the other lists. The discussion is older than Google.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Haskell-cafe reply-to etiquette

2007-12-27 Thread Justin Bailey
When I joined the haskell-cafe mailing list, I was surprised to see
the reply-to header on each message was set to the sender of a given
message to the list, rather than the list itself. That seemed counter
to other mailing lists I had been subscribed to, but I didn't think
too much about it.

Well, the comment below prompted me to ask the question - do people
care? Personally, I like to respond to the list, keeping discussions
open by default and reducing (potential) spam on someone's inbox. As
impersonal as email can be, it also seems a bit intrusive to write
someone directly who I don't have a prior relationship with except for
responding to some message they  happened to post.

Thoughts?

-- Forwarded message --
From: Claus Reinke [EMAIL PROTECTED]
Date: Dec 26, 2007 2:07 PM
Subject: Re: [Haskell] Re: ANNOUNCE: GHC version 6.8.2
To: Benjamin L. Russell [EMAIL PROTECTED], [EMAIL PROTECTED]


[if this thread has to keep running, could you please drop me of the cc?
 and how did it manage to end up on haskell@ - that is the wrong list ]


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Interesting data structure

2007-12-27 Thread Tim Docker
I'm using a control structure that's a variation of a monad and I'm
interested in whether

- it's got a name
- it deserves a name (!)
- anything else similar is used elsewhere

Please excuse the longer post...


I have two programs that need to interact with the outside world, and
I want to constrain the nature of these interactions. I don't want to
just sprinkle IO throughout the code.

In the first program, I am reading on-demand from a database - just
reading, not making any changes.

In the second, I am requesting computations to be evaluated
externally, in order to take advantage of a grid of machines.

In both of these cases, the external requests don't change the state
of the world, and the programs can be consided pure as long as
the world isn't being changed by some other means. Hence the requests
can be reordered, performed in parallel, and optimised in various ways
without affecting the result.

To make this concrete, if an external request has a type like:

a - m b

where a is the input to the request, b is the response, and m is some
monad, probably IO. Then a data structure capturing calculations over
these requests, with result type c can be:

data SCalc a b c = SCResult c
 | SCStage {
 sc_req :: a,
 sc_calc :: b - SCalc a b c
   }

The idea is that we either have a result, or we need to make a
external request, whose response is used to generate a new
calculation.

Running such a calculation is straightforward:

runSC :: (Monad m ) = SCalc a b c - (a - m b) - m c
runSC (SCResult v) _ = return v
runSC (SCStage a cf) reqf = do
b - reqf a
runSC (cf b) reqf

and calculations can be sequence by making a monad instance:

instance Monad (SCalc a b) where
   return = SCResult

   (=) (SCResult v)cf = cf v
   (=) (SCStage a cf1) cf = SCStage a (\b - cf1 b = cf)

Where it gets interesting, however, is that when they don't depend on
each other, we can run these calculations in parallel. We need the
ability to merge requests, and split responses. Hence,

class Req a where
   merge :: a - a - a

class Resp b where
   split :: b - (b,b)

par :: (Req a, Resp b) = SCalc a b c - SCalc a b d - SCalc a b (c,d)

The par primitive above can be used to define other parallel
operations, such as

parList :: (Req a, Resp b) = [SCalc a b c] - SCalc a b [c]

I found it worthwhile to try and visualise what's going on here. Let's
say I have 4 calculations that I want to run in parallel. The first
doesn't need a request; the second needs to make a single request
(A1); the third needs to make two requests where the second (B2)
depends on the result of the first (B1), etc. The resulting parallel
operations will be done in 3 batches, looking like:

 batch1  batch2   batch3   result

calc1 V0
calc2A1   V1
calc3B1  B2   --- V2
calc4C1  C2   C3   -- V3

(excuse the ascii art). batch1 will consist of A1,B1,C1 merged
together; batch2 of B2,C3 merged; etc.

In practice, I've used the above data types to abstract out database
access in some reporting code. It works quite well, as use of the
parallel primitive above means that the haskell code talking to the
database sees all of the information in each batch simultaneously, so
it can optimise the queries, remove redundant requests etc. It also
makes the reporting code pure despite the fact that information is
being loaded on demand from the db (without any unsafe calls behind
the scene). I guess the use of the term pure here should be
qualified: the impure code has been factored out to a single function
in a different module that has a limited and well defined interface.

I haven't implemented the grid calculation example described above,
though I see that it ought to be able to work similarly, potentially
removing duplicate calculation requests, etc.

So my questions are: does this sort of monad allowing parallel
evaluation structure have a name? Is it an existing design pattern
in fp somewhere that I haven't seen?

thanks,

Tim



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Interesting data structure

2007-12-27 Thread Achim Schneider
Tim Docker [EMAIL PROTECTED] wrote:

 I'm using a control structure that's a variation of a monad and I'm
 interested in whether
 
 - it's got a name
 - it deserves a name (!)
 - anything else similar is used elsewhere
 
You might have reinvented arrows in some sense:
http://www.haskell.org/arrows/syntax.html

http://www.md.chalmers.se/Cs/Research/Functional/Fudgets/userguide.html
The sequencing and parallellizing seems similar, as well as something
fuzzy about the notions of streams.

Thinking of streams, in some way the stream fusion system is similar,
if you mentally add parallelism. If not, it's an interesting read in
any case:
http://www.cse.unsw.edu.au/~dons/papers/CLS07.html


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Doing some things right

2007-12-27 Thread Ketil Malde
Don Stewart [EMAIL PROTECTED] writes:

 A Wake Up Call for the Logic Programming Community

 
 http://www.cs.kuleuven.ac.be/%7Edtai/projects/ALP//newsletter/dec07/content/Articles/tom/content.html

 Interesting read!

Clearly, the logic programming people are vastly more successful at
our prime goal: avoiding success at all costs.  We have much to learn
here :-)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Albert Y. C. Lai

Achim Schneider wrote:
[n..] == [m..], 


the first thing I notice is

n == m  n+1 == m+1

, which already expresses all of infinity in one instance and can be
trivially cancelled to

n == m

, which makes the whole darn thing only _|_ if n or m is _|_, which no
member of [n..] can be as long as n isn't or 1 or + has funny ideas.

I finally begin to understand my love and hate relationship with
formalisms: It involves cuddling with fixed points while protecting
them from evil data and fixed points they don't like as well as
reduction strategies that don't see their full beauty.


There is a formalism that says [n..]==[n..] is true. (Look for 
co-induction, observational equivalence, bismulation, ...)


There is a formalism that says [n..]==[n..] is _|_.

We know of implemented programming languages that can give an answer 
according to the latter formalism.


If you know of an implemented programming language that can give an 
answer according to the former formalism, and not just for the obvious 
[n..] but also map f xs == map g xs (for example), please spread the news.


So it comes down to which formalism, not whether formalism.

I have long known the problem with informalisms. They are full of I 
know, obviously, and ought to be. It is too tempting to take your 
wit for granted. When you make a deduction, you don't easily see whether 
it is one of a systemtic family of deductions or you are just cunning. 
You only see what you can do; you don't see what you can't do, much less 
what you can't make a computer do.


Formalisms do not tolerate such self-deception. You think something 
ought to be obvious? Write them down as axioms. Now with all your 
obviousness nailed down black on white, you have a solid ground on which 
to ask: what can be done, what can't be done, what can be done on a 
computer, how practical is it? Humility and productivity are thus restored.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Interesting data structure

2007-12-27 Thread Ryan Ingram
This monad seems to be basically the same as Prompt; see
http://www.haskell.org/pipermail/haskell-cafe/2007-November/034830.html, the
only difference I see is that Prompt allows the return value's type to
be based on the request instead of forcing everything to be wrapped in a
single result type.

You implemented the monad operations exactly the same as Prompt, and your
bind operator suffers from the same quadratic behavior problem that was
pointed out in that thread.

As was pointed out there, what you are doing is turning the potential side
effects of your computations into a term algebra, which allows you to write
different interpretation functions to use when running the calculation
(the reqf passed to runSC).  As far as I can tell, this pattern is general
enough to implement any computation, so it's not surprising that you found
it possible to use it to implement parallel computation.

As an example, here's the State monad implemented in terms of SCalc:

 data StateReq s = Get | Put s
 get :: SCalc (StateReq s) s s
 get = SCStage Get return
 put :: s - SCalc (StateReq s) s ()
 put s = SCStage (Put s) (const $ return ())

 runState :: SCalc (StateReq a) s b - s - (a, s)
 runState (SCResult v) s = (v, s)
 runState (SCStage Get cont) s = runState (cont s) s
 runState (SCStage (Put s) cont) _ = runState (cont s) s

I think it's a useful pattern and I definitely am getting a lot of use out
of Prompt in my code.  But I'm trying to figure out the best way
to eliminate the quadratic behavior of (=) that is exhibited by, for
example:

foldl1 (=) $ take 100 $ repeat $ (\x - put (x+1) = get) $ 0

The only way I've found so far is to wrap Prompt inside of ContT which
solves the problem in much the same way that difference lists (newtype DList
a = [a] - [a]) solve the problem of quadratic time append for lists.

  -- ryan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-27 Thread Jonathan Cast

On 27 Dec 2007, at 8:38 PM, Albert Y. C. Lai wrote:


Achim Schneider wrote:

[n..] == [m..], the first thing I notice is
n == m  n+1 == m+1
, which already expresses all of infinity in one instance and can be
trivially cancelled to
n == m
, which makes the whole darn thing only _|_ if n or m is _|_,  
which no

member of [n..] can be as long as n isn't or 1 or + has funny ideas.
I finally begin to understand my love and hate relationship with
formalisms: It involves cuddling with fixed points while protecting
them from evil data and fixed points they don't like as well as
reduction strategies that don't see their full beauty.


There is a formalism that says [n..]==[n..] is true. (Look for co- 
induction, observational equivalence, bismulation, ...)


But, of course, any formalism that says [n..]==[n..] = True  
interprets (==) as either not a monotone or not a continuous  
function.  Saying that [n..] = [n..] for some equivalence relation  
doesn't say anything about the value of the Haskell expression [n..]  
== [n..].


jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:45:23 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:



On 27 Dec 2007, at 9:57 AM, Cristian Baboi wrote:

Good to know. I intended to use Haskell for algorithms, but it seems it  
is not so good at them.


Very sad.  The entire point of Haskell is that it allows the user to  
transcend the algorithm as a way of expressing computations.


I hope someday you may understand Haskell, rather than just criticizing  
it.


I'm begining to understand it. Criticizing it's just a tehnique to allow  
me to understand it better.


This is what I understood:

- there is no distinction of data from functions. This seem more like a  
matter of definiton: what I call X, the X + Y or just X.


- functions can be manipulated the same way as data. This does not sound  
right.


- functions can be manipulated as easy as data. This seems better.

- functional programming is declarative. One may take a picture of all  
those pebbles, but their arrangemant does not make sense to him because no  
part of it resemble the original description.


- one cannot print things that cannot be traversed in a sequential way

The last two seems to be in contradiction.







 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:13:57 +0200, Wolfgang Jeltsch  
[EMAIL PROTECTED] wrote:



Am Donnerstag, 27. Dezember 2007 16:57 schrieb Cristian Baboi:

On Thu, 27 Dec 2007 17:52:19 +0200, Jonathan Cast
 Which is why Haskell treats IO as a domain specific language.

Good to know. I intended to use Haskell for algorithms, but it seems it  
is

not so good at them.



Why is I/O needed for algorithms?


And the fact that I/O is embedded into Haskell as a kind of a domain  
specific
language doesn’t mean that Haskell is bad at I/O.  As Simon Peyton Jones  
put

it: Haskell is the world’s finest imperative programming language.



An algorithm is a finite recipe that allow one to solve a class of  
problems in a mechanical way.

To be able to use the algorithm one must be able to read it.
To be able to communicate the algorithm, one must be able to write it.

When I mentioned that IO is not needed for pebbles, I was joking.


 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:14:53 +0200, Wolfgang Jeltsch  
[EMAIL PROTECTED] wrote:



Am Donnerstag, 27. Dezember 2007 15:53 schrieb Cristian Baboi:

On Thu, 27 Dec 2007 16:50:10 +0200, Lennart Augustsson

[EMAIL PROTECTED] wrote:
 Absolutly.  Every expression in Haskell denotes a value.
 Now, we've not agreed what value means, but to me it is a value. :)

It is one value, or several ?



It is one value with parts that are values themselves.


It is one value or a SET of values ?
What are the parts ?





 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 18:19:47 +0200, Wolfgang Jeltsch  
[EMAIL PROTECTED] wrote:



Am Donnerstag, 27. Dezember 2007 16:34 schrieb Cristian Baboi:

I'll have to trust you, because I cannot test it.

let x=(1:x); y=(1:y) in x==y .

I also cannot test this:

let x=(1:x); y=1:1:y in x==y


In these examples, x and y denote the same value but the result of x ==  
y is
_|_ (undefined) in both cases.  So (==) is not really equality in  
Haskell but

a kind of weak equality: If x doesn’t equal y, x == y is False, but if x
equals y, x == y might be True or undefined.


Thank you.

I can only notice that y always has an even number of 1, which is not the  
case for x :-)




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 17:35:54 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:



Only on Von Neuman machines.  Haskell implementations are not required  
to run on Von Neuman machines.  That's why the language is called  
functional.  (Imperative languages, by contrast, are just abstractions  
of the underlying Von Neuman architecture, which is probably the source  
of your confusion).


Can you tell me what is it that make a language imperative ?

When I learned about formal grammars and languages, there was no  
discussion about this.




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] Wikipedia on first-class object

2007-12-27 Thread Cristian Baboi
On Thu, 27 Dec 2007 17:39:25 +0200, Jonathan Cast  
[EMAIL PROTECTED] wrote:


Haskell is not a computer programming language; Haskell implementations  
are not required to run on computers.  Haskell is a formal notation for  
computation (completely unrelated to the Von Neuman machine sitting on  
your desk).  It can be implemented on Von Neuman machines, because they  
are still universal Turing machines, but it is /not/ a radical attack on  
the problem of programming peripherals!


How do you call that thing that implement Haskell ?




 Information from NOD32 
This message was checked by NOD32 Antivirus System for Linux Mail Servers.
 part000.txt - is OK
http://www.eset.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe