Re: [Haskell] Paper: The essence of dataflow programming

2005-09-26 Thread Einar Karttunen
On 26.09 01:01, David Menendez wrote:
 We'll also define the injection combinator from Kieburtz's paper[1]:
 
  (.) :: Functor d = d a - b - d b
  d . a = fmap (const a) d

We add some nice combinators:


(-) :: Comonad co = (co a - co b) - (co b - co c) - co a - co c
a - b = b . a
infixr -

(--) :: Comonad co = (co a - co b) - (b - co b - co c) - co a - co c
a -- b = \co - let x = a co in b (counit x) x
infixr --

coreturn v = cobind (const v)


And define the simple state comonad:


data StateC st a = StateC (st - a) st

instance Comonad (StateC st) where
  counit (StateC f v) = f v
  cobind fun (StateC f v) = StateC (\v - fun (StateC f v)) v

get :: StateC st a - StateC st st
get (StateC _ st) = StateC id st

set :: st - StateC st a - StateC st a
set new (StateC fun _) = StateC fun new

modify :: (c - c) - StateC c a - StateC c a
modify mutator (StateC fun st) = StateC fun $ mutator st

runStateC fun v0 = let StateC a b = fun (StateC id v0) in (a b,b)


Now we can write comonadic code like monadic code:

foobar = get -- \x - coreturn (3*x)

test3 = get -- \x -
set 15  -
foobar  -- \y -
set x   -
coreturn (show y)


This looks very much like monadic code written with  and =.

A general Functor instance is easy (but non-haskell98):


instance Comonad w = Functor w where
  fmap f = cobind (f . counit)


- Einar Karttunen
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Making shared libraries with Haskell

2005-09-26 Thread Joel Reymont

Folks,

Is the procedure of creating shared libraries with Haskell and  
loading them from C described somewhere?


Is this even possible?

Thanks, Joel

--
http://wagerlabs.com/




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


Re: [Haskell] Paper: The essence of dataflow programming

2005-09-26 Thread Tarmo Uustalu

Dear Dave,

Thanks for the nice propaganda!

A few comments regarding the points you made in your message.

Ineffeciency of fibo-like programs: Your observations are true. But this is a 
comonadic interpreter analogous to the cbv monadic interpreter. One can also 
define an analogue to the cbn monadic interpreter. This is better than the 
cbv version on the n first Fibonacci numbers but worse on the nth number 
alone...

Zippers: Yes, of course! Streams are an infinite linear datastructure, but you 
can also do trees (eg decorated parse trees of a CFG). Such trees with a 
distinguished position are of course the zipper datatype and this is a comonad 
as well. And similarly to the comonadic approach to the semantics of dataflow 
languages one can give a comonadic structure eg to attribute grammar 
specifications (either purely synthesized attribute grammars or general 
attribute grammars). We've developed these ideas in a paper that was presented 
at TFP, see

http://www.cs.ioc.ee/~tarmo/papers/tfp05.pdf

(this is the symposium version, the full version is in preparation.)

To present the comonadic semantics of attribute grammar specifications neatly, 
one needs either GADTs or dependent types.

Best wishes,

Tarmo U


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


[Haskell] Haskell Interfacing With VB

2005-09-26 Thread Craig Middlemast








Hello,



I computing student entering my final year at Northumbria University,
Newcastle upon Tyne. I am doing some research for
my final year project which is to design and build a Syntax Directed Editor for
a high level computing language.



The problem which I have is that I would like to use
VB as a user interface and Haskell as the parser, however I am not sure if this
is possible. Therefore I was hoping that you could answer the question regarding
Haskell and VB interfacing, is it possible to interface the two languages, and
if so could you give me some insight how this can be achieved.



Regards



Craig Middlemast






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


[Haskell] ICTCS 2005: Call for participation

2005-09-26 Thread g. michele pinna

Ninth Italian Conference on
 Theoretical Computer Science (ICTCS'05)

  Certosa di Pontignano (Siena), Italy
   October 12 - 14, 2005

  http://ictcs05.dsmi.unisi.it

 Call for Partecipation

The Ninth Italian Conference on Theoretical Computer
Science will take place at the Certosa di Pontignano
(Siena), Italy.

There will be three invited speakers:

Luca Cardelli (Microsoft Research, Cambridge, United Kingdom)
Giuseppe Castagna (LIENS - École Normale Supérieure, Paris,
   France)
Nicola Santoro (School of Computer Science,
Carleton University, Ottawa, Canada)

Program Committee:
Michele Bugliesi (Venezia),
Mario Coppo (Torino, Co-Chair),
Pierluigi Crescenzi (Firenze),
Giulia Galbiati (Pavia)
Luisa Gargano (Salerno),
Giorgio Ghelli  (Pisa),
Roberto Grossi (Pisa),
Benedetto Intrigila  (L'Aquila),
Nicola Leone   (Cosenza),
Elena Lodi (Siena, Co-Chair),
Flaminia Luccio (Trieste),
Andrea Masini  (Verona),
Giancarlo Mauri (Milano),
Corrado Priami  (Trento),
Geppino Pucci (Padova),
Davide Sangiorgi (Bologna).

Preliminary program:
Wednesday, October 12:
08,45 - 09,00 Welcome
09,00 - 10,00 L. Cardelli: Biological System as Reactive Systems
10,00 - 11,00 B. DasGupta, S. Ferrarini, U. Gopalakrishnan,
  N. Paryani:
Inapproximability Results for the Lateral
Gene Transfer Problem
  S. Mantaci, A. Restivo, G. Rosone, M. Sciortino:
A new combinatorial approach to sequence comparison
11,00 - 11,20 coffee break
11,20 - 13,20 M. Bartoletti, P. Degano, G. L. Ferrari:
Checking Risky Events is Enough for Local Policy
  B. Aziz, D. Gray, G. Hamilton:
A Static Analsis of PKI-Based Systems
  R. Medel, A. Compagnoni, E. Bonelli:
A Typed Assembly Language for Non-interference
  L. Bettini, V. Bono, S. Likavec:
Safe Object Composition in the Presence of Subtyping

13,20 - 15,00 Lunch
15,00 - 17,00 L. A. Hemaspaandra, J. Rothe, A. Saxena:
Enforcing and Defying Associativity, Commutativity,
Totality, and Strong Noninvertibility for One-Way
Functions in Complexity Theory
  J. Fiala, J. Kratochvil:
On the computational complexity of the
L(2,1)-labeling problem for regular graphs
  B. Escoffier, J. Monnot, V. T. Paschos:
Weighted coloring: further complexity and
approximability results
  V. Raman, S. Saurabh, S. Sikdar:
Improved Exact Exponential Algorithms for Vertex
Bipartization and Other Problems
17,00 - 17,20 coffee break
17,20 - 19,20 S. van Bakel, U. de' Liguoro:
Subtyping Object and Recursive Types Logically
  J. Schwinghammer:
A Typed Semantics of Higher Order Store and Subtyping
  W. Jamroga, J. Dix:
Model Checking Strategic Abilities of Agents under
Incomplete Information
  S. Heymans, D. Van Nieuwenborgh, D. Vermeir:
Synthesis from Temporal Specifications using Preferred
Answer Set Programming
20,00 -   Dinner

Thursday, October 13:
09,00 - 10,00 N. Santoro: Mobile Agents Computing: Security Issues
and Algorithmic Solutions
10,00 - 11,00 T. Kuboyama, K. Shin, T. Miyahara, H. Yasuda:
A Theoretical Analysis of Alignment and Edit Problems
for Trees
  L. Anderegg, M. Cieliebak, G. Prencipe:
Efficient Algorithms for Detecting Regular Point
Configurations
11,00 - 11,20 coffee break
11,20 - 13,20 R. Statman:
Two Variables are Not Enough
  S. van Bakel, S. Lengrand, P. Lescanne:
The language X: Circuits, Computations and Classical
Logic
  C. Bertolissi:
The Graph Rewriting Calculus: confluence and
Expressiveness
  N. Busi, G. Zavattaro:
Reachability Analysis in Boxed Ambients
13,20 - 15,00 Lunch
15,15 - 17,15 G. De Marco, M. Pellegrini, G. Sburlati:
Faster Deterministic Wakeup in Multiple Access
Channels
  M-C. Costa, F. Jarray, C. Picoleau:
Reconstructing an alternate periodical binary matrix
from its orthogonal projections
  S. Fung, F. Chin, C. K. Poon:
Laxity helps in broadcast scheduling
  Y. Asahiro, E. Miyano, S. Shimoirisa:
Pickup and Delivery for Moving Objects on Broken Lines
17,30 - Excursion to Siena
18,00 - 20,00 EATCS Italian Chapter Annual Meeting (at the
Dipartimento di Scienze Matematiche e Informatiche
R. Magari
20,30 -   Social dinner

Friday, October 14:
09,00 - 10,00 G. 

Re: [Haskell] Haskell Interfacing With VB

2005-09-26 Thread Cale Gibbard
On 25/09/05, Craig Middlemast [EMAIL PROTECTED] wrote:
 Hello,

 I computing student entering my final year at Northumbria University,
 Newcastle upon Tyne. I am doing some research for my final year project
 which is to design and build a Syntax Directed Editor for a high level
 computing language.

 The problem which I have is that I would like to use VB as a user interface
 and Haskell as the parser, however I am not sure if this is possible.
 Therefore I was hoping that you could answer the question regarding Haskell
 and VB interfacing, is it possible to interface the two languages, and if so
 could you give me some insight how this can be achieved.

 Regards

 Craig Middlemast

Well, I don't know about VB, but if you're after a library with a nice
GUI editor, you might try using Glade (http://glade.gnome.org/) with
Gtk2Hs (http://haskell.org/gtk2hs/) which I've been finding to be
quite a nice combination of tools. You can use Glade to produce XML
templates of user interfaces which you can load in your Haskell
program by using the functions in Graphics.UI.Gtk.Glade from Gtk2Hs.

I've never tried doing this on win32, but apparently there is a win32
port of Glade (http://gladewin32.sourceforge.net/), so I think it
should be possible to get things to work.

Someone else might be able to tell you about using VB... I seem to
recall some people working on .net integration for Haskell, though I'm
not sure how that's going. I'm not really a windows user myself.

anyway, hope this is useful
 - Cale
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] IO functions reference?

2005-09-26 Thread Creighton Hogg
Hi,
I've been trying to write some code in Haskell and have been 
running into trouble not knowing the already built-in IO 
functions.  For example, is there a function that will take 
a line and turn it into a list?
Is there a reference where one can lookup all these things?

Thanks,
Creighton Hogg
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Re: IO functions reference?

2005-09-26 Thread Stephane Bortzmeyer
On Mon, Sep 26, 2005 at 10:19:09AM -0500,
 Creighton Hogg [EMAIL PROTECTED] wrote 
 a message of 13 lines which said:

 Is there a reference where one can lookup all these things?

I use:

http://www.zvon.org/other/haskell/Outputglobal/index.html

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


Re: [Haskell] IO functions reference?

2005-09-26 Thread Cale Gibbard
On 26/09/05, Creighton Hogg [EMAIL PROTECTED] wrote:
 Hi,
 I've been trying to write some code in Haskell and have been
 running into trouble not knowing the already built-in IO
 functions.  For example, is there a function that will take
 a line and turn it into a list?
 Is there a reference where one can lookup all these things?

 Thanks,
 Creighton Hogg

Well, the standard prelude is the first thing to read:
http://www.haskell.org/onlinereport/standard-prelude.html

Then refer to the standard libraries:
http://www.haskell.org/ghc/docs/latest/html/libraries/index.html
for lots more.

Also in Part II of the report, there's further documentation for some
of the libraries (though they have been moved into the hierarchy).
http://www.haskell.org/onlinereport/
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] Haskell Interfacing With VB

2005-09-26 Thread shelarcy

On Mon, 26 Sep 2005 04:44:37 +0900, Craig Middlemast
[EMAIL PROTECTED] wrote:

I computing student entering my final year at Northumbria University,
Newcastle upon Tyne. I am doing some research for my final year project
which is to design and build a Syntax Directed Editor for a high level
computing language.


Do you see Proxima (http://www.cs.uu.nl/research/projects/proxima/)
and its thesis?
Proxima isn't Syntax-directed editor, but it tries to integrate
Syntax-directed
editors and Syntax-recognizing editor's idea, and Proxima thesis
shows its Architechture.

If you intereseted in that, you can get source code by cvs.
I don't know that CVS HEAD works well. but it is helpful for you.

The problem which I have is that I would like to use VB as a user  
interface

and Haskell as the parser, however I am not sure if this is possible.
Therefore I was hoping that you could answer the question regarding  
Haskell
and VB interfacing, is it possible to interface the two languages, and  
if so

could you give me some insight how this can be achieved.


Proxima depend on wxHaskell (http://wxhaskell.sourceforge.net/).
wxHaskell is one of the option to implement GUI program.
If you think wxHaskell's editor program support is very poor,
you can use Haste (http://haste.dyndns.org:8080/)'s website patch.


--
shelarcy shelarcy capella.freemail.ne.jp
http://page.freett.com/shelarcy/
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell-cafe] Template Haskell and Types

2005-09-26 Thread Gracjan Polak

Simon Peyton-Jones wrote:

Hmm.  Q is a monad, so I think
fail :: Monad m = String - m a
will do the job.

'recover' should catch the exception, and let you try something else.


So I think I have bug report :)

Haskell-cafe is probably wrong place for this, where do I go now with my 
failing test cases?


--
Gracjan



Simon

| -Original Message-
| From: Gracjan Polak [mailto:[EMAIL PROTECTED]
| Sent: 20 September 2005 10:43
| To: Simon Peyton-Jones
| Cc: haskell-cafe@haskell.org
| Subject: Re: [Haskell-cafe] Template Haskell and Types
| 
| Simon Peyton-Jones wrote:

|  design note http://research.microsoft.com/~simonpj/tmp/notes2.ps
| 
| 
| In the above paper there is something about 'giveUp'. Seems to quite

| useful, but there is no such thing in ghc 6.4.
| 
| Where did my giveUp go? And why?
| 
| --

| Gracjan


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


Re: [Haskell-cafe] Template Haskell and Types

2005-09-26 Thread Duncan Coutts
On Mon, 2005-09-26 at 10:36 +0200, Gracjan Polak wrote:
 Simon Peyton-Jones wrote:
  Hmm.  Q is a monad, so I think
  fail :: Monad m = String - m a
  will do the job.
  
  'recover' should catch the exception, and let you try something else.
 
 So I think I have bug report :)
 
 Haskell-cafe is probably wrong place for this, where do I go now with my 
 failing test cases?

glasgow-haskell-bugs@haskell.org

or if it's not clear if it's a bug or not you could ask for advice on:


[EMAIL PROTECTED]
or


glasgow-haskell-users@haskell.org

Duncan

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


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

2005-09-26 Thread Henning Thielemann

On Fri, 23 Sep 2005, Marcin Tustin wrote:

   Thanks for this: All I have to do now is fix the fact that my maths is 
 stupidly screwed!

'div' is the integer division and rounds down. You should either use
Rational (or Double) everywhere or use % which builds a ratio from two
integers.


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


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

2005-09-26 Thread Henning Thielemann

On Sat, 24 Sep 2005, Marcin Tustin wrote:

 For some reason the following code is producing an error message from ghci 
 that the the patterns are non-exhaustive. Does anyone have any idea why that 
 could be, given that the patterns are, at least in my meaning, provably 
 exhaustive?

 choosenonuniqueset n (a:r)
 | (length r)   (n-1) = [ (sort (a:x)) | x - (choosenonuniqueset (n-1) 
 r)]
 `union`
 [ (sort (a:x)) | x - (choosenonuniqueset n r)]
 | (length r) == (n-1) = [a:r]
 | (length r)   (n-1) = []

You need to compare only once. Better write:

choosenonuniqueset n (a:r) =
  case compare (length r) (n-1) of
 GT - ...
 EQ - [a:r]
 LT - []

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


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

2005-09-26 Thread Rene de Visser

Hello,

I need to zip together multiple lists.

The lists are sorted by date, and each entry in the list represents data for 
a time interval.

The time intervals between the lists may be missmatched from each other.

This means that sometimes you don't need to move forward in list, while you 
move forward in other lists. It might also mean that you need to skip a 
number of entries foward.


If the computation does not need part of the contents of one of the lists, 
then this list should be ignored until it is needed.


As the lists are sorted you never need to go backwards.

I found it fairly easy to write a zipper for two lists, where  the items 
from both lists are needed (example binary operator on the payload of the 
list).


However the combination of merging multiple lists together, and ignoring a 
list in the case it is not needed by the computation leads to very messy 
code.


I though about if there was a away of encapsulating this in a monad, but 
haven't thought of any way to do this.


Another idea is to have a mutable cursor for each list and move these 
forward as required. But I guess this might be worth avoiding?


I think it would be good if somehow I could encapsulate each list, so on a 
per list basis, and can say given me the current head, or move one forward. 
But I haven't figured out how to pass the state of the other threads 
invisibly through.


I guess the ony way might be to use the state monad?
I guess there can be no simple recursive solution?

Rene.


___
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-26 Thread ChrisK

Rene de Visser wrote:
 Hello,
 
 I need to zip together multiple lists.
 
 The lists are sorted by date, and each entry in the list represents data
 for a time interval.
 The time intervals between the lists may be missmatched from each other.
 

Does a single list have only disjoint intervals?  If not, then this it
is more annoying to write.  If they are disjoint then it is straightforward.

 This means that sometimes you don't need to move forward in list, while
 you move forward in other lists. It might also mean that you need to
 skip a number of entries foward.
 
 If the computation does not need part of the contents of one of the
 lists, then this list should be ignored until it is needed.
 
 As the lists are sorted you never need to go backwards.
 
 I found it fairly easy to write a zipper for two lists, where  the items
 from both lists are needed (example binary operator on the payload of
 the list).
 

Doing this for two lists with a recursive function is easy. There being
an output element whenever the intervals of the two input lists overlap.

 However the combination of merging multiple lists together, and ignoring
 a list in the case it is not needed by the computation leads to very
 messy code.
 

Do mean multiple as in at least three?  If so, then what do have an
output element only if all three or more input elements overlap, or do
you have an output element when at least two input elements overlap?

 I though about if there was a away of encapsulating this in a monad, but
 haven't thought of any way to do this.
 
 Another idea is to have a mutable cursor for each list and move these
 forward as required. But I guess this might be worth avoiding?
 
 I think it would be good if somehow I could encapsulate each list, so on
 a per list basis, and can say given me the current head, or move one
 forward. But I haven't figured out how to pass the state of the other
 threads invisibly through.
 
 I guess the ony way might be to use the state monad?
 I guess there can be no simple recursive solution?
 
 Rene.
 
 
 ___
 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] Help wanted: Lazy multiway zipper with mismached intervals

2005-09-26 Thread Rene de Visser

From: ChrisK [EMAIL PROTECTED]
Rene de Visser wrote:
Does a single list have only disjoint intervals?

Yes. The lists are strictly increasing

Doing this for two lists with a recursive function is easy. There being
an output element whenever the intervals of the two input lists overlap.

Yes, I have done this.


 However the combination of merging multiple lists together, and ignoring
 a list in the case it is not needed by the computation leads to very
 messy code.


Do mean multiple as in at least three?

Yes


 If so, then what do have an
output element only if all three or more input elements overlap, or do
you have an output element when at least two input elements overlap?


That can depend on the values (payloads) per entry. For example I might have 
a selector operator and one of the lists steers from which of the other 
lists I should take the value for that interval.


I think a continuation per list would provide a nice solution.
But I don't know how to do that, and it might be horribly ineffecient?

Rene.


___
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-26 Thread Robin Green
On Monday 26 September 2005 17:14, Rene de Visser wrote:
 Hello,

 I need to zip together multiple lists.

 The lists are sorted by date, and each entry in the list represents data
 for a time interval.
 The time intervals between the lists may be missmatched from each other.

Is this the sort of thing you want?

module Main where

data Event = Event { time :: Int, what :: String } deriving (Eq, Show)

zipToMaybes :: [Event] - [Event] - [(Maybe Event, Maybe Event)]
zipToMaybes [] [] = []
zipToMaybes [] (h:t) = ((Nothing, Just h):(zipToMaybes [] t))
zipToMaybes (h:t) [] = ((Just h, Nothing):(zipToMaybes t []))
zipToMaybes (ha:ta) (hb:tb)
| (time ha) == (time hb)  = ((Just ha, Just hb):(zipToMaybes ta tb))
| (time ha)  (time hb)   = ((Just ha, Nothing):(zipToMaybes ta 
(hb:tb)))
| otherwise   = ((Nothing, Just hb):(zipToMaybes (ha:ta) 
tb))

main = interact $ const $ show $ zipToMaybes [Event 0 Got up, Event 1 Had 
breakfast, Event 3 Went to work] [Event 0 Got up, Event 2 Went to 
work]

___
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-26 Thread John Meacham
Why not have a merging function which takes all lists and merges them
into a single ordered list marked with which list the events came from
and their timestamps. Then you can just traverse this single, merged
list. if I am understanding the problem properly...  
John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 
___
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-26 Thread John Meacham
Doh! ignore me. apparently I understand the problem, but offer nothing
in the way of solution. :)
John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe