[Haskell-cafe] newbe question

2005-09-27 Thread feucht
Hi
i can not load program test1 into hugs, but test2 works.
Am i missing some special syntax?

greetings,
Philip

-- test1 --

foo :: Maybe Int - Int
foo Nothing =-1
foo (Just a)= a

-- test2 --

foo :: Maybe Int - Int
foo Nothing = -1
--   ^
--   +-- note an extra space
foo (Just a)= a
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] newbe question

2005-09-27 Thread Thomas Davie

The reason is that you can define =- as on operator

so for example, in this (obfuscated) code:

(=-) x y = x * y

sq y = y =- y

Thus, in your code, you had an operator on the LHS of the definition,  
and the interpreter baulked at it.


Bob

On 27 Sep 2005, at 10:34, [EMAIL PROTECTED] wrote:



Hi
i can not load program test1 into hugs, but test2 works.
Am i missing some special syntax?

greetings,
Philip

-- test1 --

foo :: Maybe Int - Int
foo Nothing =-1
foo (Just a)= a

-- test2 --

foo :: Maybe Int - Int
foo Nothing = -1
--   ^
--   +-- note an extra space
foo (Just a)= a
___
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] newbe question

2005-09-27 Thread Wolfgang Jeltsch
Am Dienstag, 27. September 2005 11:34 schrieb [EMAIL PROTECTED]:
 Hi
 i can not load program test1 into hugs, but test2 works.
 Am i missing some special syntax?

 greetings,
 Philip

 -- test1 --

 foo :: Maybe Int - Int
 foo Nothing =-1
 foo (Just a)= a

 -- test2 --

 foo :: Maybe Int - Int
 foo Nothing = -1
 --   ^
 --   +-- note an extra space
 foo (Just a)= a

Hello,

obviously, Hugs thinks that =- is a special operator.  In Haskell you have the 
ability to define your own operators, so it would be possible to define an 
operator =-.  I would suggest that you always put spaces around the = in 
declarations.

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


Re: [Haskell-cafe] newbe question

2005-09-27 Thread feucht
On 27 Sep, Wolfgang Jeltsch wrote:

 Hello,
 
 obviously, Hugs thinks that =- is a special operator.  In Haskell you have 
 the 
 ability to define your own operators, so it would be possible to define an 
 operator =-.  I would suggest that you always put spaces around the = in 
 declarations.
 
 Best wishes,
 Wolfgang


Hello,
thank you for fast reply. 
Ok, but what is the semantic of '=-' ? If it's an operator, it should
have some impact (right term?).

Greetings,
Philip


 ___
 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] newbe question

2005-09-27 Thread Thomas Davie


On 27 Sep 2005, at 16:53, [EMAIL PROTECTED] wrote:



On 27 Sep, Wolfgang Jeltsch wrote:




Hello,

obviously, Hugs thinks that =- is a special operator.  In Haskell  
you have the
ability to define your own operators, so it would be possible to  
define an
operator =-.  I would suggest that you always put spaces around  
the = in

declarations.

Best wishes,
Wolfgang





Hello,
thank you for fast reply.
Ok, but what is the semantic of '=-' ? If it's an operator, it should
have some impact (right term?).



The semantics are whatever you define them to be:

(=-) x y = doSomeFunkyStuff x y

Note that this also introduces problems with comments, a common  
mistake people make is to not put a space after the -- comment  
symbol, so they may end up with:


--| something

The compiler then interprets --| as an operator.

Bob

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


Re: [Haskell-cafe] Help wanted: Lazy multiway zipper with mismached intervals

2005-09-27 Thread Rene de Visser

Many thanks to all for the replies

From: ChrisK [EMAIL PROTECTED]



Could the interval for element x of List xList overlap with more than
one element of another list?  It does not matter too much, but is
something you did not clarify.  In general, how may the intervals for
all the lists overlap?  (The answer may be too complex, in which case
you can just ignore me).


Yes, unlimited overlap is possible. e.g. Infinite interval in one list, and 
infinitely many small intervals in another list.



I would start by merging, perhaps in stages, into an intermediate list
with elements of its own data FooIntermediate = A _ [_]| B  _ [(_,_)] |
C _ _ _ | ... types.

Yes, I'll probably use this suggestion, maybe with records to make partial 
update easier.



If you need to change the semantics of merging the streams then it may
help when you refactor that the types of events are now types of
constructors and the compiler is checking your code.
Originally I had thought that I could treat the merge symetrically, but I 
now think this is not the case. Still I am not sure if I will use different 
types for different types of merge.


Rene.


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


[Haskell-cafe] Neural networks and optimization in Haskell

2005-09-27 Thread Joel Reymont

Folks,

I got a project where I have a large number of variables and an  
outcome and I need to figure out which 20% of the variables has the  
largest effect on the outcome. Of course I also need to optimize the  
20% of variables I end up with.


This sounds like a job for a neural network to me, with arguments  
possibly optimized through genetic algorithms. I'm wondering, though,  
if I'm complicating things for myself and there's an easier approach  
to this. If not I'm wondering if there are ready-made NN or GA  
libraries for Haskell.


Also, I'm curious if Haskell is really the best language for this  
type of problem and if lazy evaluation brings any specific advantages  
to the solution or would be a hindrance.


I would welcome any pointers and feedback, yes, someone is actually  
paying me to do this :-).


Thanks, Joel

--
http://wagerlabs.com/




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


[Haskell-cafe] XMLParse module

2005-09-27 Thread Huong Nguyen
Hello all,

I am reading XMLParse module
http://www.germane-software.com/repositories/public/StatusReport/trunk/hxml-0.2/XMLParse.hs
But, I am not clear about the purpose of this module and the function of two functions:
parseInstance = unfoldr (pRun instanceItem) . pcdataModeparseDTD = foldl (\a b-b a) emptyDTD . unfoldr (pRun dtdItem) . markupModeparseDocument text = case pRun prolog (pcdataMode text) of
	Just (_, rest)	- unfoldr (pRun instanceItem) rest	Nothing		- [ErrorEvent Error parsing prolog]	-- can't happen.

If any knows the meaning of those, please let me know.

Thanks a lot.

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


Re: [Haskell-cafe] newbe question

2005-09-27 Thread Glynn Clements

[EMAIL PROTECTED] wrote:

  obviously, Hugs thinks that =- is a special operator.  In Haskell you have 
  the 
  ability to define your own operators, so it would be possible to define an 
  operator =-.  I would suggest that you always put spaces around the = in 
  declarations.
  
  Best wishes,
  Wolfgang
 
 
 Hello,
 thank you for fast reply. 
 Ok, but what is the semantic of '=-' ? If it's an operator, it should
 have some impact (right term?).

It isn't defined in the prelude or any of the standard libraries.

The point is that the Haskell tokeniser treats any consecutive
sequence of the symbols !#$%*+./=[EMAIL PROTECTED]|-~ as a single operator 
token. 
This occurs regardless of whether a definition exists for the
operator.

More generally, the tokenising phase is unaffected by whether or not
an operator, constructor, identifier etc is defined. A specific
sequence of characters will always produce the same sequence of tokens
regardless of what definitions exist.

-- 
Glynn Clements [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] newbe question

2005-09-27 Thread feucht
On 27 Sep, Glynn Clements wrote:

 It isn't defined in the prelude or any of the standard libraries.
 
 The point is that the Haskell tokeniser treats any consecutive
 sequence of the symbols !#$%*+./=[EMAIL PROTECTED]|-~ as a single operator 
 token. 
 This occurs regardless of whether a definition exists for the
 operator.
 
 More generally, the tokenising phase is unaffected by whether or not
 an operator, constructor, identifier etc is defined. A specific
 sequence of characters will always produce the same sequence of tokens
 regardless of what definitions exist.
 

Thank you,
that is the problem i am wrestling with.

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