|
2 | 2 |
|
3 | 3 | # agda2hs
|
4 | 4 |
|
5 |
| -Agda2hs is a tool for producing verified and readable Haskell code by |
6 |
| -extracting it from a (lightly annotated) Agda program. For example, |
7 |
| -the following Agda program encodes well-formed binary search trees: |
8 |
| - |
9 |
| -```agda |
10 |
| -open import Haskell.Prelude |
11 |
| -
|
12 |
| -_≤_ : {{Ord a}} → a → a → Set |
13 |
| -x ≤ y = (x <= y) ≡ True |
14 |
| -
|
15 |
| -data BST (a : Set) {{@0 _ : Ord a}} (@0 lower upper : a) : Set where |
16 |
| - Leaf : (@0 pf : lower ≤ upper) → BST a lower upper |
17 |
| - Node : (x : a) (l : BST a lower x) (r : BST a x upper) → BST a lower upper |
18 |
| -
|
19 |
| -{-# COMPILE AGDA2HS BST #-} |
20 |
| -``` |
21 |
| - |
22 |
| -agda2hs translates this to the following Haskell datatype: |
23 |
| - |
24 |
| -```haskell |
25 |
| -module BST where |
26 |
| - |
27 |
| -data BST a = Leaf |
28 |
| - | Node a (BST a) (BST a) |
29 |
| -``` |
30 |
| - |
31 |
| -## Objective |
32 |
| - |
33 |
| -The goal of this project is *not* to translate arbitrary Agda code to Haskell. |
34 |
| -Rather it is to carve out a common sublanguage between Agda and Haskell, |
35 |
| -with a straightforward translation from the Agda side to the Haskell side. |
36 |
| -This lets you write your program in the Agda fragment, using full Agda |
37 |
| -to prove properties about it, and then translate it to nice looking readable |
38 |
| -Haskell code that you can show your Haskell colleagues without shame. |
| 5 | +Agda2hs is a tool for producing verified and readable Haskell code by extracting |
| 6 | +it from a (lightly annotated) Agda program. The goal of this project is *not* to |
| 7 | +translate arbitrary Agda code to Haskell. Rather it is to carve out a common |
| 8 | +sublanguage between Agda and Haskell, with a straightforward translation from |
| 9 | +the Agda side to the Haskell side. This lets you write your program in the Agda |
| 10 | +fragment, using full Agda to prove properties about it, and then translate it to |
| 11 | +nice looking readable Haskell code that you can show your Haskell colleagues |
| 12 | +without shame. |
39 | 13 |
|
40 | 14 | ## Documentation
|
41 | 15 |
|
|
0 commit comments