Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Clearly, Haskell is ill-founded
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Conor McBride  
View profile  
 More options Jul 16 2007, 3:15 am
Newsgroups: fa.haskell
From: Conor McBride <c...@Cs.Nott.AC.UK>
Date: Mon, 16 Jul 2007 07:15:16 UTC
Local: Mon, Jul 16 2007 3:15 am
Subject: Re: [Haskell-cafe] Clearly, Haskell is ill-founded
Hi Derek

On 16 Jul 2007, at 02:48, Derek Elkins wrote:

> On Mon, 2007-07-16 at 02:29 +0100, Conor McBride wrote:
>> Hi

>>> data{-codata-} Punter = Speak String (String -> Punter)

[..]

>>> data{-codata-} Stream x = x :> (Stream x)

>>> cafe :: Punter -> (String -> Punter) -> Stream (String, String)
>>> cafe (Speak question learn) guru =
>>>   let  Speak answer guru' = guru question
>>>   in   (question, answer) :> (cafe (learn answer) guru')

> If the Punter asks the appropriate question, perhaps the guru will  
> spend
> the rest of time thinking about an answer.

It's true that answers can take a while, but not forever if the guru is
also a productive coprogram. In more realistic examples, mere  
productivity
might not be enough: you might want to be sure that questions will
eventually be answered, after some initial segment of "busy" responses.

To that end, an exercise. Implement a codata type

data{-codata-} Mux x y = ...

which intersperses x's and y's in such a way that

   (1) an initial segment of a Mux does not determine whether the next
     element is an x or a y (ie, no forced *pattern* of alternation)

   (2) there are productive coprograms

         demuxL :: Mux x y -> Stream x
         demuxR :: Mux x y -> Stream y

     (ie, alternation is none the less forced)

You may need to introduce some (inductive) data to achieve this. If you
always think "always", then you need codata, but if you eventually think
"eventually", you need data.

All the best

Conor

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.