## Typed Logical Variables in Haskell (2000)

Venue: | In Proceedings Haskell Workshop |

Citations: | 18 - 0 self |

### BibTeX

@INPROCEEDINGS{Claessen00typedlogical,

author = {Koen Claessen and Peter Ljunglöf},

title = {Typed Logical Variables in Haskell},

booktitle = {In Proceedings Haskell Workshop},

year = {2000}

}

### OpenURL

### Abstract

We describe how to embed a simple typed functional logic programming language in Haskell. The embedding is a natural extension of the Prolog embedding by Seres and Spivey [16]. To get full static typing we need to use the Haskell extensions of quantified types and the ST-monad. 1 Introduction Over the last ten to twenty years, there have been many attempts to combine the flavours of logic and functional programming [3]. Among these, the most well-known ones are the programming languages Curry [4], Escher [13], and Mercury [14]. Curry and Escher can be seen as variations on Haskell, where logic programming features are added. Mercury can be seen as an improvement of Prolog, where types and functional programming features are added. All three are completely new and autonomous languages. Defining a new programming language has as a drawback for the developer to build a new compiler, and for the user to learn a new language. A different approach which has gained a lot of popularity ...

### Citations

334 | Functional logic programming: From theory to Curry
- Hanus
- 2013
(Show Context)
Citation Context ...he Haskell extensions of quantified types and the ST-monad. 1 Introduction Over the last ten to twenty years, there have been many attempts to combine the flavours of logic and functional programming =-=[3]-=-. Among these, the most well-known ones are the programming languages Curry [4], Escher [13], and Mercury [14]. Curry and Escher can be seen as variations on Haskell, where logic programming features ... |

156 | Type classes with functional dependencies
- Jones
- 2000
(Show Context)
Citation Context ...declare the type class Free as: class Free s a --- a -? s where free :: LP s a Note that we use the non-standard Haskell extension of multiple parameter type classes with functional dependencies here =-=[11]-=-. This is possible because all instantiations of a will contain an s . With this we can define the free predicate for each of our types: instance Free s (Atom s) where free = VarA `liftM` newLPRef Not... |

138 | Building domain-specific embedded languages
- Hudak
- 1996
(Show Context)
Citation Context ...t of popularity the last couple of years is to embed a new language in another language, called the host language. Haskell has been shown to be extremely well-suited for this purpose in various areas =-=[8, 2, 1]-=-. The embedding approach has an obvious other advantage. Programs in the embedded language are first class citizens in the host language, and can therefore be generated by a program in the host langua... |

106 | Lazy functional state threads
- Launchbury, Jones
- 1994
(Show Context)
Citation Context ...n in advance which term datatypes we are going to use, this is a problem. The problem can be solved if we move out of Haskell 98, and use one of the extensions available in GHC and Hugs: the ST-monad =-=[12]-=-. With the ST-monad, one has the capability to safely create, read and update reference cells of arbitrary type. Another element in the embedding that is dependent on a certain term datatype is unific... |

92 | Polytypic programming
- Jeuring, Jansson
- 1996
(Show Context)
Citation Context ...ion algorithm can now be implemented as follows. 3 This could be very much simplified if we had subtyping as in the language O'Haskell [15]. 4 There exist a general polytypic solution to this problem =-=[9, 10]-=-, which takes a similar approach. ( : =) :: Unify s a ) a ! a ! LP s () a : = b = case (isVar a, isVar b) of (Just var1, Just var2) --- var1 == var2 ! true (Just var ,s) ! unifyVar var b ( , Just var ... |

23 |
Reactive Objects and Functional Programming
- Nordlander
- 1999
(Show Context)
Citation Context ...f Nothing ! writeLPRef ref (Just a) Just b ! a : = b The unification algorithm can now be implemented as follows. 3 This could be very much simplified if we had subtyping as in the language O'Haskell =-=[15]-=-. 4 There exist a general polytypic solution to this problem [9, 10], which takes a similar approach. ( : =) :: Unify s a ) a ! a ! LP s () a : = b = case (isVar a, isVar b) of (Just var1, Just var2) ... |

20 | S.: Combinators for logic programming
- Spivey, Seres
(Show Context)
Citation Context ...m is to embed logic programming features in Haskell. To this end, several different approaches have been taken, noticably by Seres and Spivey, who embed a language of predicates over terms in Haskell =-=[16, 17]-=-, and by Hinze, who shows how to describe backtracking efficiently and elegantly [5, 6]. Our approach combines these ideas and adds something new: the terms of the embedded program are, in contrast to... |

19 |
Polytypic unification
- Jansson, Jeuring
- 1998
(Show Context)
Citation Context ...ion algorithm can now be implemented as follows. 3 This could be very much simplified if we had subtyping as in the language O'Haskell [15]. 4 There exist a general polytypic solution to this problem =-=[9, 10]-=-, which takes a similar approach. ( : =) :: Unify s a ) a ! a ! LP s () a : = b = case (isVar a, isVar b) of (Just var1, Just var2) --- var1 == var2 ! true (Just var ,s) ! unifyVar var b ( , Just var ... |

16 | Embedding Prolog in Haskell
- Spivey, Seres
- 1999
(Show Context)
Citation Context ...s.se August 9, 2000 Abstract We describe how to embed a simple typed functional logic programming language in Haskell. The embedding is a natural extension of the Prolog embedding by Seres and Spivey =-=[16]-=-. To get full static typing we need to use the Haskell extensions of quantified types and the ST-monad. 1 Introduction Over the last ten to twenty years, there have been many attempts to combine the f... |

13 | Polytypic functions over nested datatypes
- Hinze
- 1999
(Show Context)
Citation Context ...datatype. However, the types get a lot more complicated and become unmanageable when dealing with more complicated types than regular datatypes. Another big help would be a polytypic programming tool =-=[9, 7]-=-. The resulting language is rather naive in several ways. First of all, the syntax of the programs is often more clumsy than the way you could write it in a dedicated logic programming language. This ... |

6 |
Programming in an integrated functional and logic programming language
- Lloyd
- 1999
(Show Context)
Citation Context ...n to twenty years, there have been many attempts to combine the flavours of logic and functional programming [3]. Among these, the most well-known ones are the programming languages Curry [4], Escher =-=[13]-=-, and Mercury [14]. Curry and Escher can be seen as variations on Haskell, where logic programming features are added. Mercury can be seen as an improvement of Prolog, where types and functional progr... |

5 | Prological features in a functional setting - axioms and implementations
- Hinze
- 1998
(Show Context)
Citation Context ...aches have been taken, noticably by Seres and Spivey, who embed a language of predicates over terms in Haskell [16, 17], and by Hinze, who shows how to describe backtracking efficiently and elegantly =-=[5, 6]-=-. Our approach combines these ideas and adds something new: the terms of the embedded program are, in contrast to Seres' and Spivey's approach, typed. The resulting embedded language has several limit... |

4 |
An embedded language approach to hardware description and verification
- Claessen
- 2000
(Show Context)
Citation Context ...t of popularity the last couple of years is to embed a new language in another language, called the host language. Haskell has been shown to be extremely well-suited for this purpose in various areas =-=[8, 2, 1]-=-. The embedding approach has an obvious other advantage. Programs in the embedded language are first class citizens in the host language, and can therefore be generated by a program in the host langua... |

2 |
An embedded modeling language approach to interactive 3d and multimedia animation
- Eliott
- 1999
(Show Context)
Citation Context ...t of popularity the last couple of years is to embed a new language in another language, called the host language. Haskell has been shown to be extremely well-suited for this purpose in various areas =-=[8, 2, 1]-=-. The embedding approach has an obvious other advantage. Programs in the embedded language are first class citizens in the host language, and can therefore be generated by a program in the host langua... |

2 |
An integrated functional logic language, February 2000. The current report describing the language Curry, http://www.informatik.unikiel. de/~curry/report.html
- Curry
(Show Context)
Citation Context ... the last ten to twenty years, there have been many attempts to combine the flavours of logic and functional programming [3]. Among these, the most well-known ones are the programming languages Curry =-=[4]-=-, Escher [13], and Mercury [14]. Curry and Escher can be seen as variations on Haskell, where logic programming features are added. Mercury can be seen as an improvement of Prolog, where types and fun... |

2 | Deriving monad transformers
- Hinze
- 1999
(Show Context)
Citation Context ...aches have been taken, noticably by Seres and Spivey, who embed a language of predicates over terms in Haskell [16, 17], and by Hinze, who shows how to describe backtracking efficiently and elegantly =-=[5, 6]-=-. Our approach combines these ideas and adds something new: the terms of the embedded program are, in contrast to Seres' and Spivey's approach, typed. The resulting embedded language has several limit... |