Debian Codegraph @

tests/text/tabular/Main.agda

raw
1 -- This is taken from README.Text.Tabular
2
3 {-# OPTIONS --guardedness #-}
4
5 module Main where
6
7 open import Function.Base
8
9 open import Data.List.Base
10 open import Data.String.Base
11 open import Data.Vec.Base
12
13 open import IO.Base
14 open import IO.Finite
15
16 open import Text.Tabular.Base
17 import Text.Tabular.List as Tabularˡ
18 import Text.Tabular.Vec as Tabularᵛ
19
20 main : Main
21 main = run $ do
22 putStrLn $
23 unlines (Tabularᵛ.display unicode
24 (Right ∷ Left ∷ Center ∷ [])
25 ( ("foo" ∷ "bar" ∷ "baz" ∷ [])
26 ∷ ("1" ∷ "2" ∷ "3" ∷ [])
27 ∷ ("6" ∷ "5" ∷ "4" ∷ [])
28 ∷ []))
29
30 let foobar = ("foo" ∷ "bar" ∷ [])
31 ∷ ("1" ∷ "2" ∷ [])
32 ∷ ("4" ∷ "3" ∷ [])
33 ∷ []
34
35 putStrLn $
36 unlines (Tabularᵛ.display unicode
37 (Right ∷ Left ∷ [])
38 foobar)
39
40 putStrLn $
41 unlines (Tabularᵛ.display ascii
42 (Right ∷ Left ∷ [])
43 foobar)
44
45 putStrLn $
46 unlines (Tabularᵛ.display whitespace
47 (Right ∷ Left ∷ [])
48 foobar)
49
50 putStrLn $
51 unlines (Tabularᵛ.display (compact unicode)
52 (Right ∷ Left ∷ [])
53 foobar)
54
55 putStrLn $
56 unlines (Tabularᵛ.display (noBorder unicode)
57 (Right ∷ Left ∷ [])
58 foobar)
59
60 putStrLn $
61 unlines (Tabularᵛ.display (addSpace unicode)
62 (Right ∷ Left ∷ [])
63 foobar)
64
65 putStrLn $
66 unlines (Tabularᵛ.display (compact (addSpace unicode))
67 (Right ∷ Left ∷ [])
68 foobar)
69
70 putStrLn $
71 unlines (Tabularˡ.display unicode
72 (Center ∷ Right ∷ [])
73 ( ("foo" ∷ "bar" ∷ [])
74 ∷ ("partial" ∷ "rows" ∷ "are" ∷ "ok" ∷ [])
75 ∷ ("3" ∷ "2" ∷ "1" ∷ "..." ∷ "surprise!" ∷ [])
76 ∷ []))
77
78 putStrLn $
79 unlines (unsafeDisplay (compact unicode)
80 ( ("foo" ∷ "bar" ∷ [])
81 ∷ (" 1" ∷ " 2" ∷ [])
82 ∷ (" 4" ∷ " 3" ∷ [])
83 ∷ []))