## Prological Features In A Functional Setting Axioms And Implementations (1998)

Venue: | In Third Fuji Int. Symp. on Functional and Logic Programming |

Citations: | 5 - 0 self |

### BibTeX

@INPROCEEDINGS{Hinze98prologicalfeatures,

author = {Ralf Hinze},

title = {Prological Features In A Functional Setting Axioms And Implementations},

booktitle = {In Third Fuji Int. Symp. on Functional and Logic Programming},

year = {1998},

pages = {98--122}

}

### OpenURL

### Abstract

this paper is twofold. First, we show that Prological features

### Citations

1649 | The Definition of Standard ML
- Milner, Tofte, et al.
- 1990
(Show Context)
Citation Context ...m by 11 = raise e ??= a ! k a p m by 19 = raise e by 18 The try construct plays a similar role for exception handling as once for backtracking. For that reason we obtain similar laws. try fail = fail =-=(20)-=- try (return a p m) = return (Right a) p try m (21) try (raise e) = return (Left e) (22) try (try m ??= k) = try m ??= a ! try (k a) (23) The laws have been chosen to conform to the Prolog ISO standar... |

1380 | The essence of functional programming
- Wadler
- 1992
(Show Context)
Citation Context ...ions are concerned with the interplay of (??=) with fail and (p): fail is a left zero of (??=), and (??=) distributes leftward through (p). fail ??= k = fail (7) (m p n) ??= k = (m ??= k) p (n ??= k) =-=(8)-=- We have paraphrased m p n as `try m first, if it fails try n'. This is, of course, an oversimplification: even if m succeeds it may be necessary to try n because a `future' computation which depends ... |

780 | Notions of computation and monads
- Moggi
- 1991
(Show Context)
Citation Context ...for instance, interaction a strict left to right execution is indispensable. Turning to the laws we have that fail and (p) form a monoid: fail p m = m (4) m p fail = m (5) (m p n) p o = m p (n p o) : =-=(6)-=- Generally, (p) is neither commutative nor idempotent, that is to say order and multiplicity of solutions matters. Take as an extreme example the definition of Prolog's control construct repeat . repe... |

349 | The integration of functions into logic programming: From theory to practice
- Hanus
- 1994
(Show Context)
Citation Context ...f backtracking and interaction. The function trace implements a simple trace facility based on the 4 port procedure model of Prolog 14 : trace m msg behaves as m except that the user is informed when =-=(1) m is call-=-ed the first time, (2) m is exited upon success, (3) m fails, and (4) m is re-entered upon backtracking. trace :: (Backtr m; InOut m) ) m a ! String ! m a trace m msg = do (say "call" p do s... |

253 | Monad transformers and modular interpreters
- Liang, Hudak, et al.
- 1995
(Show Context)
Citation Context ...the tracer of Section 3.3 would make no sense. 12 Here are the laws for once. nothing :: (Monad m) ) m (Maybe a) nothing = return Nothing once fail = nothing (9) once (return a p m) = return (Just a) =-=(10)-=- (once m ??= k) p n = once m ??= a ! k a p n (11) once (once m ??= k) = once m ??= a ! once (k a) (12) Recall that once m succeeds exactly once, in other words it is a deterministic predicate. Using o... |

203 |
The Art of Prolog: Advanced Programming Techniques
- Shapiro, Sterling
- 1994
(Show Context)
Citation Context ...m \Phi n = do x / m; y / n; return (x ++ y) The operator (\Phi) essentially lifts (++) to the level of computations. Note that nil is a unit of (\Phi), and that (\Phi) is associative. sols fail = nil =-=(13)-=- sols (return a) = return [ a ] (14) sols (m p n) = sols m \Phi sols n (15) sols (once m ??= k) = once m ??= a ! sols (k a) (16) once (sols m) = map Just (sols m) (17) Equation 16 is similar to 11 and... |

201 | Standard ML of New Jersey
- McQueen, Appel
- 1991
(Show Context)
Citation Context ...r role for exception handling as once for backtracking. For that reason we obtain similar laws. try fail = fail (20) try (return a p m) = return (Right a) p try m (21) try (raise e) = return (Left e) =-=(22)-=- try (try m ??= k) = try m ??= a ! try (k a) (23) The laws have been chosen to conform to the Prolog ISO standard 2 . In particular Equation 21 lays down, that try is re-satisfiable. This implies that... |

177 |
An Abstract View of Programming Languages
- Moggi
- 1989
(Show Context)
Citation Context ...nse: if a computation involves, for instance, interaction a strict left to right execution is indispensable. Turning to the laws we have that fail and (p) form a monoid: fail p m = m (4) m p fail = m =-=(5)-=- (m p n) p o = m p (n p o) : (6) Generally, (p) is neither commutative nor idempotent, that is to say order and multiplicity of solutions matters. Take as an extreme example the definition of Prolog's... |

134 | The glasgow haskell compiler: a technical overview
- Jones, Hall, et al.
- 1992
(Show Context)
Citation Context ...y 18 The try construct plays a similar role for exception handling as once for backtracking. For that reason we obtain similar laws. try fail = fail (20) try (return a p m) = return (Right a) p try m =-=(21)-=- try (raise e) = return (Left e) (22) try (try m ??= k) = try m ??= a ! try (k a) (23) The laws have been chosen to conform to the Prolog ISO standard 2 . In particular Equation 21 lays down, that try... |

115 | A fold for all seasons
- Sheard, Fegaras
- 1993
(Show Context)
Citation Context ...mitives. We will see that the interplay of exception handling and backtracking is particularly interesting. 13 The operation raise e is expected to satisfy the following laws. raise e ??= k = raise e =-=(18)-=- once (raise e) = raise e (19) Signaling an error terminates the current computation: raise e is a left zero of bind. Equation 19 lays down that raise e propagates through once. Despite appearance 19 ... |

72 | Composing monads
- Jones, Duponcheel
- 1993
(Show Context)
Citation Context ... lifts (++) to the level of computations. Note that nil is a unit of (\Phi), and that (\Phi) is associative. sols fail = nil (13) sols (return a) = return [ a ] (14) sols (m p n) = sols m \Phi sols n =-=(15)-=- sols (once m ??= k) = once m ??= a ! sols (k a) (16) once (sols m) = map Just (sols m) (17) Equation 16 is similar to 11 and 12; it states that a deterministic computation may be pushed out of a call... |

65 | an efficient purely declarative logic programming language
- Somogyi, Henderson, et al.
- 1995
(Show Context)
Citation Context ... Here are the laws for once. nothing :: (Monad m) ) m (Maybe a) nothing = return Nothing once fail = nothing (9) once (return a p m) = return (Just a) (10) (once m ??= k) p n = once m ??= a ! k a p n =-=(11)-=- once (once m ??= k) = once m ??= a ! once (k a) (12) Recall that once m succeeds exactly once, in other words it is a deterministic predicate. Using once we can characterize deterministic computation... |

60 |
Programming objects with ml-art, an extension to ml with abstract and record types
- Rémy
- 1994
(Show Context)
Citation Context ...il is a unit of (\Phi), and that (\Phi) is associative. sols fail = nil (13) sols (return a) = return [ a ] (14) sols (m p n) = sols m \Phi sols n (15) sols (once m ??= k) = once m ??= a ! sols (k a) =-=(16)-=- once (sols m) = map Just (sols m) (17) Equation 16 is similar to 11 and 12; it states that a deterministic computation may be pushed out of a call to sols . Equation 17 identifies sols as determinist... |

56 | A mathematical definition of full Prolog
- Börger, Rosenzweig
- 1995
(Show Context)
Citation Context ...cility based on the 4 port procedure model of Prolog 14 : trace m msg behaves as m except that the user is informed when (1) m is called the first time, (2) m is exited upon success, (3) m fails, and =-=(4) m is re-entered upon backtracking. trac-=-e :: (Backtr m; InOut m) ) m a ! String ! m a trace m msg = do (say "call" p do say "fail"; fail ) a / m (say "exit" p do say "redo"; fail ) return a where say ... |

50 | First-class polymorphism with type inference
- Jones
- 1997
(Show Context)
Citation Context ... is associative. sols fail = nil (13) sols (return a) = return [ a ] (14) sols (m p n) = sols m \Phi sols n (15) sols (once m ??= k) = once m ??= a ! sols (k a) (16) once (sols m) = map Just (sols m) =-=(17)-=- Equation 16 is similar to 11 and 12; it states that a deterministic computation may be pushed out of a call to sols . Equation 17 identifies sols as deterministic. 4.2 Exception handling This section... |

37 | Benchmarking implementations of lazy functional languages
- Hartel, Langendoen
- 1993
(Show Context)
Citation Context ...cking. For that reason we obtain similar laws. try fail = fail (20) try (return a p m) = return (Right a) p try m (21) try (raise e) = return (Left e) (22) try (try m ??= k) = try m ??= a ! try (k a) =-=(23)-=- The laws have been chosen to conform to the Prolog ISO standard 2 . In particular Equation 21 lays down, that try is re-satisfiable. This implies that try m behaves as map Right m provided m does not... |

19 |
Operational and denotational semantics of Prolog
- Arbab, Berry
- 1987
(Show Context)
Citation Context ...a simple trace facility based on the 4 port procedure model of Prolog 14 : trace m msg behaves as m except that the user is informed when (1) m is called the first time, (2) m is exited upon success, =-=(3) m fails, and (4) m is re-entered upon b-=-acktracking. trace :: (Backtr m; InOut m) ) m a ! String ! m a trace m msg = do (say "call" p do say "fail"; fail ) a / m (say "exit" p do say "redo"; fail ) re... |

16 |
On implementing Prolog in functional programming
- Carlsson
- 1984
(Show Context)
Citation Context ...We can take this into account simply by dropping 25 for ' = inp. Certain I/O actions may require additional laws. The following two equations, for instance, further constrain out . out "" = =-=return () (26)-=- out (s 1 ++ s 2 ) = out s 1 ?? out s 2 (27) Now the time has come to answer the questions posed in the introduction to this section. Using out s ?? m = once (out s) ?? m and 11 we see that (out s ?? ... |

13 |
Integrating Prolog into the Poplog Environment
- Mellish, Hardy
- 1983
(Show Context)
Citation Context ...be pushed out of a call to try . 4.3 Input and output For simplicity let us assume that I/O actions are deterministic and safe. Let ' be an I/O operation such as out s or inp then once ' = map Just ' =-=(24)-=- try ' = map Right ' (25) 14 are expected to hold. The second assumption is probably debatable: inp typically raises an exception if the end of the input is reached. We can take this into account simp... |

7 |
Report on the programming language Haskell 1.4, a non-strict, purely functional language
- Peterson, Hammond
- 1997
(Show Context)
Citation Context ... (Maybe a) nothing = return Nothing once fail = nothing (9) once (return a p m) = return (Just a) (10) (once m ??= k) p n = once m ??= a ! k a p n (11) once (once m ??= k) = once m ??= a ! once (k a) =-=(12)-=- Recall that once m succeeds exactly once, in other words it is a deterministic predicate. Using once we can characterize deterministic computations: m is deterministic iff once m = map Just m. Of cou... |

3 | Efficient monadic-style backtracking
- Hinze
- 1996
(Show Context)
Citation Context ...interplay of exception handling and backtracking is particularly interesting. 13 The operation raise e is expected to satisfy the following laws. raise e ??= k = raise e (18) once (raise e) = raise e =-=(19)-=- Signaling an error terminates the current computation: raise e is a left zero of bind. Equation 19 lays down that raise e propagates through once. Despite appearance 19 has far reaching consequences:... |

2 |
1, General Core, Committee Draft 1.0
- Part
- 1992
(Show Context)
Citation Context ...The function trace implements a simple trace facility based on the 4 port procedure model of Prolog 14 : trace m msg behaves as m except that the user is informed when (1) m is called the first time, =-=(2) m is exited upon success-=-, (3) m fails, and (4) m is re-entered upon backtracking. trace :: (Backtr m; InOut m) ) m a ! String ! m a trace m msg = do (say "call" p do say "fail"; fail ) a / m (say "ex... |

2 |
How to declare an imperative (invited paper
- Wadler
- 1995
(Show Context)
Citation Context ...e is not a zero of (p). The next two equations are concerned with the interplay of (??=) with fail and (p): fail is a left zero of (??=), and (??=) distributes leftward through (p). fail ??= k = fail =-=(7)-=- (m p n) ??= k = (m ??= k) p (n ??= k) (8) We have paraphrased m p n as `try m first, if it fails try n'. This is, of course, an oversimplification: even if m succeeds it may be necessary to try n bec... |

2 |
Danvy and Andrzey Filinski. Abstracting control
- Olivier
- 1990
(Show Context)
Citation Context ...o try . 4.3 Input and output For simplicity let us assume that I/O actions are deterministic and safe. Let ' be an I/O operation such as out s or inp then once ' = map Just ' (24) try ' = map Right ' =-=(25)-=- 14 are expected to hold. The second assumption is probably debatable: inp typically raises an exception if the end of the input is reached. We can take this into account simply by dropping 25 for ' =... |