[Haskell-cafe] Re: Purely logical programming language

Sebastian Fischer sebf at informatik.uni-kiel.de
Wed May 27 04:02:02 EDT 2009


On May 27, 2009, at 1:01 AM, Ahn, Ki Yung wrote:

> By the way, did Curry solved the problem of how to deal with IO and  
> backtracking issues? (where and  where not should IO happen kind of  
> a thing)

Curry uses the IO monad to specify where IO actions may happen. Non- 
determinism is not excluded statically from IO actions but usually  
leads to a run-time error (see Section 7.1 of [1]). For example the  
Curry systems PAKCS [2] and MCC [3] show the following behaviour (the  
infix operator (?) denotes non-deterministic choice):

   $ pakcs
   Prelude> print (1?2)
   1
   2
   ERROR: non-determinism in I/O actions occurred!
   Prelude> :q
   $ cyi
   Prelude> print (1?2)
   Error: cannot duplicate the world
   Prelude> :q

In order to use non-deterministic operations in an IO context, their  
results need to be *encapsulated*, i.e., collected in a data structure  
(e.g. a list). See [4,5] for recent research on encapsulated search.

The Curry System KiCS [6] uses encapsulated search implicitly in IO  
operations and uses the first result if there is one and only yields  
an error otherwise:

   $ kicsi
   Prelude> print (1?2)
   1
   Prelude> print (1=:=2)
   non-exhaustive patterns in function Prelude._case_1
   <interactive>: program error
   Prelude> :q

Cheers,
Sebastian

[1]: http://www.informatik.uni-kiel.de/~curry/report.html
[2]: http://www.informatik.uni-kiel.de/~pakcs/
[3]: http://danae.uni-muenster.de/~lux/curry/
[4]: http://www.informatik.uni-kiel.de/~mh/papers/JFLP04_findall.html
[5]: Computing with subspaces, http://web.cecs.pdx.edu/~antoy/homepage/publications.html
[6]: http://www.informatik.uni-kiel.de/prog/mitarbeiter/bernd-brassel/projects/


-- 
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)





More information about the Haskell-Cafe mailing list