[Haskell-cafe] Re: [Haskell] Arrows GUI Library Based on GTK+

Kevin Atkinson kevina at cs.utah.edu
Tue Mar 22 11:52:04 EST 2005


On Sun, 20 Mar 2005 ross at soi.city.ac.uk wrote:

> On Sat, Mar 19, 2005 at 12:17:46PM -0700, Kevin Atkinson wrote:
> > On Sat, 19 Mar 2005 ross at soi.city.ac.uk wrote:
> > > I would also have expected loopFG to have been defined using fixIO.
> > 
> > Could you be more specific.  Ie How?
> 
> For the type definitions
> 
> 	newtype FG' a b = FG' (Control -> a -> IO (Control, b))
> 	newtype FG a b = FG (FGState -> IO (FG' a b, FGState))
> 	newtype Container a b = Container (FG ([WidgetP], a) b)
> 
> the usual instances would be (give or take a ~):
> 
> 	instance ArrowLoop FG' where
> 		loop (FG' f) = FG' $ \ c x -> do
> 			(c', x', _) <- mfix $ \ ~(_, _, y) -> do
> 				~(c', ~(x', y')) <- f c (x, y)
> 				return (c', x', y')
> 			return (c', x')

I must admit that I am baffled by what this is doing.  But I don't think 
it has the semantics I want.  When I try substituting your 
code in I get "Exception: <<loop>>".  I have reworked the way loops are 
handled.  Please have a look at the new code at 
http://www.haskell.org/arrows/.

-- 
http://kevin.atkinson.dhs.org



More information about the Haskell-Cafe mailing list