-- | output module for dihaa: write UTF8 using unicode box drawing -- ------------------------------------------------------------------- -- Copyright (C) 2017 by Sascha Wilde -- This program is free software under the GNU GPL (>=v2) -- Read the file COPYING coming with the software for details. -- ------------------------------------------------------------------- module Dihaa.OutputUTF8 (outputUTF8) where import Dihaa import TwoD import qualified Data.Vector as V graph2utf8 :: Glyph -> Char graph2utf8 LineH = '─' graph2utf8 LineV = '│' graph2utf8 CornerNW = '┌' graph2utf8 CornerNE = '┐' graph2utf8 CornerSW = '└' graph2utf8 CornerSE = '┘' graph2utf8 TeeWNE = '┴' graph2utf8 TeeWSE = '┬' graph2utf8 TeeNWS = '┤' graph2utf8 TeeNES = '├' graph2utf8 Cross = '┼' graph2utf8 ArrowN = '▲' graph2utf8 ArrowS = '▼' graph2utf8 ArrowW = '◀' graph2utf8 ArrowE = '▶' graph2utf8 Space = ' ' graph2utf8 (Verbatim c) = c outputUTF8 :: Dia -> String outputUTF8 d = unlines $ toLists $ graph2utf8 <$> d