Re: [Haskell-cafe] nondet function

2006-09-10 Thread Lennart Augustsson
To make it referentially transparent you might want to consider  
adding 'por', parallel or, instead.  It's like (||), but symmetric in  
its treatment of bottom.


-- Lennart

On Sep 10, 2006, at 00:21 , Ashley Yakeley wrote:


Is it possible to write nondet?

  nondet :: a -> a -> a

  nondet _|_ _|_ = _|_
  nondet _|_ q = q
  nondet p _|_ = p
  nondet p q = p or q

nondet evaluates its arguments in parallel, and returns the first  
one of
them to evaluate. It's thus a bit different from the "par" of GPH.  
This

isn't referentially transparent, of course, but maybe it could be
written in the IO monad:

  nondet p q = unsafePerformIO (getnondet p q)

  getnondet :: a -> a -> IO a

--
Ashley Yakeley, Seattle WA

___
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] nondet function

2006-09-09 Thread Tom Phoenix

On 9/9/06, Ashley Yakeley <[EMAIL PROTECTED]> wrote:


Is it possible to write nondet?


Yes; it (or something very similar) is discussed here:

   http://www.haskell.org/haskellwiki/Timing_out_computations

Hope this helps!

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


[Haskell-cafe] nondet function

2006-09-09 Thread Ashley Yakeley
Is it possible to write nondet?

  nondet :: a -> a -> a

  nondet _|_ _|_ = _|_
  nondet _|_ q = q
  nondet p _|_ = p
  nondet p q = p or q

nondet evaluates its arguments in parallel, and returns the first one of 
them to evaluate. It's thus a bit different from the "par" of GPH. This 
isn't referentially transparent, of course, but maybe it could be 
written in the IO monad:

  nondet p q = unsafePerformIO (getnondet p q)

  getnondet :: a -> a -> IO a

-- 
Ashley Yakeley, Seattle WA

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