[Haskell] Arrows GUI Library Based on GTK+
Kevin Atkinson
kevina at cs.utah.edu
Sat Mar 19 12:51:13 EST 2005
On Sat, 19 Mar 2005 ross at soi.city.ac.uk wrote:
> On Sat, Mar 19, 2005 at 07:48:09AM -0700, Kevin Atkinson wrote:
> > Has anyone tried to make Fudgets an instance of the Arrow class?
>
> see the stream processors in John Hughes's original paper.
I will have a closer look.
> > > - how about: data Event a = NoEvent | Event a
> >
> > And what would "a" be?
>
> The thing you currently always pair with an Event, and ignore if it's
> NoEvent.
But that value may also be used even if there is not an event. For
example you may want to read the current value of an Entry or a
ToggleButton.
> > > - you don't really need mkAFunDef in AbstractFunction, and indeed you
> > > don't need AbstractFunction either -- you could just use Arrow, of
> > > which both (->) and FG are already instances.
> >
> > But than can I make a function like "tag" which can either be used as an
> > arrow or a function.
>
> But functions are arrows: (->) is an instance of the Arrow class.
But of separate Arrow instances. For example if I redefine tag from
tag :: (AbstractFunction f) => b -> f (Event, a) (Event, b)
tag v = mkAFun (\(e, _) -> (e, v))
to
tag :: b -> (Event, a) -> (Event, b)
tag v = \(e, _) -> (e, v)
Than I couldn't do as I gave in my example:
a <- tag "a" <<< button [] -< def
--
http://kevin.atkinson.dhs.org
More information about the Haskell
mailing list