How can I implement this arrow? Thanks

Yu Di diyu01 at hotmail.com
Tue Sep 16 15:32:48 EDT 2003


What I am trying to do is to use Haskell to simulate some process, and 
meanwhile collecting information about the data-flow throughout the whole 
process into the output. The (String, a) example is just a simplified 
version of that. Thanks for pointing out my mistakes, I will try to do it as 
a decorated-data combinator.

Thanks again,

Di, Yu
9.16

>From: Derek Elkins <ddarius at hotpop.com>
>To: Yu Di <diyu01 at hotmail.com>
>CC: haskell at haskell.org, Ashley Yakeley <ashley at semantic.org>
>Subject: Re: How can I implement this arrow? Thanks
>Date: Tue, 16 Sep 2003 12:24:17 -0400
>
>On Tue, 16 Sep 2003 01:52:03 -0700
>Ashley Yakeley <ashley at semantic.org> wrote:
>
> > In article <Sea1-F33yfxRydC3hSs00038d72 at hotmail.com>,
> >  "Yu Di" <diyu01 at hotmail.com> wrote:
>
>Replying to both:
>
> > > Hi, I want to create an arrow which is essentially
> > >
> > > data MyArrow a b = MyArrow ((String, a) -> (String,b))
> >
> > I don't think this type is an arrow. For a "product arrow", i.e. an
> > instance of Hughes' "Arrow" class with "first" defined, you can define
> > this:
>
>Oh, it's definitely an arrow.
>
> > > i.e. there is an "information" asscioated with each piece of data
> > > (represented by the string),
>
>So make a data type that sticks together something and it's information.
>
> > > and I want to pass it around.
>
>What's wrong with the support Haskell already has for passing around
>things?  Why do you think you need an arrow?
>
>From how you read the meaning of the MyArrow type, you are apparently
>misunderstanding what arrows are.  Arrows generalize functions.
>As such things of arrow type are intuitively transformers and the arrow
>framework standardizes how to stick transformations together to make a
>larger transformation. The things in an arrow's representation are
>what's required for the implementations of the transformations.
>Therefore, things in an arrows representation are, in a sense, "owned"
>by the arrow computation. This is evidenced by a) arrows have a fully
>polymorphic type, they place no restrictions on their input; within the
>computation, the String in MyArrow is not even visible let alone
>required to be provided, and b) the above arrow is the State arrow
>specialized to Strings. The String is the state and is owned by the
>computation. You are having trouble defining 'first' as you'd like
>because what you want is to duplicate the state of the
>computation. -The- (there is only one at any time) String being passed
>around isn't associated with the objects.
>
>From the sounds of it you simply want a combinator library that operates
>on some decorated data.  A monad or arrow may be useful to support
>that, e.g. the environment monad, but a monad/arrow isn't that.  You
>haven't really given much detail to what you're ultimately trying to
>achieve so I can't really provide much advice.
>

_________________________________________________________________
Use custom emotions -- try MSN Messenger 6.0! 
http://www.msnmessenger-download.com/tracking/reach_emoticon



More information about the Haskell mailing list