@@ -0,0 +1,26 @@
1+module Main where
2+
3+import System.Exit (exitFailure)
4+
5+import Graphics.Vty.UnicodeWidthTable.Types
6+import Graphics.Vty.UnicodeWidthTable.IO
7+
8+main :: IO ()
9+main = do
10+ let r1 = WidthTableRange 0 100 1
11+ r2 = WidthTableRange 101 200 2
12+ t = UnicodeWidthTable { unicodeWidthTableRanges = [r1, r2]
13+ }
14+
15+ writeUnicodeWidthTable "testfile.dat" t
16+ result <- readUnicodeWidthTable "testfile.dat"
17+
18+ case result of
19+ Left msg -> do
20+ putStrLn $ "Error reading table: " <> msg
21+ exitFailure
22+ Right t2 -> do
23+ putStrLn "Original table:"
24+ print t
25+ putStrLn "New table:"
26+ print t2