Debian Codegraph @

src/Data/Tree/Binary/Show.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- 1 dimensional pretty printing of binary trees
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --sized-types #-}
8
9 open import Level using (Level)
10 open import Data.List.Base as List using (List; []; [_]; _∷_; _∷ʳ_)
11 open import Data.String.Base using (String)
12 import Data.Tree.Rose as Rose
13 import Data.Tree.Rose.Show as Rose
14 open import Data.Tree.Binary using (Tree; map)
15 open import Function.Base using (_∘′_; id)
16
17 module Data.Tree.Binary.Show where
18
19 private
20 variable
21 a : Level
22 N L : Set a
23
24 display : Tree (List String) (List String) → List String
25 display = Rose.display ∘′ Rose.fromBinary id id
26
27 show : (N → List String) → (L → List String) → Tree N L → List String
28 show nodeStr leafStr = display ∘′ map nodeStr leafStr
29
30 showSimple : (N → String) → (L → String) → Tree N L → List String
31 showSimple nodeStr leafStr = show ([_] ∘′ nodeStr) ([_] ∘′ leafStr)