| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Some examples showing how the Rose tree module can be used |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --sized-types #-} |
| 8 |
|
| 9 |
module README.Data.Tree.Rose where |
| 10 |
|
| 11 |
open import Data.List.Base |
| 12 |
open import Data.String.Base using (String; unlines) |
| 13 |
open import Data.Tree.Rose using (Rose; node) |
| 14 |
open import Function.Base |
| 15 |
open import Agda.Builtin.Equality |
| 16 |
|
| 17 |
------------------------------------------------------------------------ |
| 18 |
-- Pretty-printing |
| 19 |
|
| 20 |
open import Data.Tree.Rose.Show using (display) |
| 21 |
|
| 22 |
_ : unlines (display |
| 23 |
$ node [ "one" ] |
| 24 |
(node [ "two" ] [] |
| 25 |
∷ node ("three" ∷ "and" ∷ "four" ∷ []) |
| 26 |
(node [ "five" ] [] |
| 27 |
∷ node [ "six" ] (node [ "seven" ] [] ∷ []) |
| 28 |
∷ node [ "eight" ] [] |
| 29 |
∷ []) |
| 30 |
∷ node [ "nine" ] |
| 31 |
(node [ "ten" ] [] |
| 32 |
∷ node [ "eleven" ] [] ∷ []) |
| 33 |
∷ [])) |
| 34 |
≡ "one |
| 35 |
\ \ ├ two |
| 36 |
\ \ ├ three |
| 37 |
\ \ │ and |
| 38 |
\ \ │ four |
| 39 |
\ \ │ ├ five |
| 40 |
\ \ │ ├ six |
| 41 |
\ \ │ │ └ seven |
| 42 |
\ \ │ └ eight |
| 43 |
\ \ └ nine |
| 44 |
\ \ ├ ten |
| 45 |
\ \ └ eleven" |
| 46 |
_ = refl |