{-| Module : System.IO.Terminal.Characters Copyright : (c) UU, 2019 License : MIT Maintainer : Tom Smeding Stability : experimental Portability : POSIX, macOS, Windows Access to a small database of box-drawing characters. -} module System.IO.Terminal.Characters (boxChar, BoxChar, BoxWeight(..)) where import qualified Data.Map.Strict as Map -- | Description of a box-drawing character: (up, right, down, left) type BoxChar = (BoxWeight, BoxWeight, BoxWeight, BoxWeight) -- | Description of one arm of a box-drawing character. data BoxWeight = BoxNone | BoxSingle | BoxHeavy | BoxDouble deriving (Eq, Ord, Show) -- | Look up a box drawing character in the unicode table. Note that not -- all combinations are valid; currently, the function throws an error if -- the character doesn't exist. boxChar :: BoxChar -> Char boxChar tup = mapping Map.! tup where mapping = Map.fromList [((BoxNone, BoxNone, BoxNone, BoxSingle), '╴') ,((BoxNone, BoxNone, BoxNone, BoxHeavy), '╸') ,((BoxSingle, BoxNone, BoxNone, BoxNone), '╵') ,((BoxHeavy, BoxNone, BoxNone, BoxNone), '╹') ,((BoxNone, BoxSingle, BoxNone, BoxNone), '╶') ,((BoxNone, BoxHeavy, BoxNone, BoxNone), '╺') ,((BoxNone, BoxNone, BoxSingle, BoxNone), '╷') ,((BoxNone, BoxNone, BoxHeavy, BoxNone), '╻') ,((BoxNone, BoxSingle, BoxNone, BoxSingle), '─') ,((BoxNone, BoxHeavy, BoxNone, BoxHeavy), '━') ,((BoxNone, BoxHeavy, BoxNone, BoxSingle), '╼') ,((BoxNone, BoxSingle, BoxNone, BoxHeavy), '╾') ,((BoxSingle, BoxNone, BoxSingle, BoxNone), '│') ,((BoxHeavy, BoxNone, BoxHeavy, BoxNone), '┃') ,((BoxSingle, BoxNone, BoxHeavy, BoxNone), '╽') ,((BoxHeavy, BoxNone, BoxSingle, BoxNone), '╿') ,((BoxNone, BoxSingle, BoxSingle, BoxNone), '┌') ,((BoxNone, BoxHeavy, BoxSingle, BoxNone), '┍') ,((BoxNone, BoxSingle, BoxHeavy, BoxNone), '┎') ,((BoxNone, BoxHeavy, BoxHeavy, BoxNone), '┏') ,((BoxNone, BoxNone, BoxSingle, BoxSingle), '┐') ,((BoxNone, BoxNone, BoxSingle, BoxHeavy), '┑') ,((BoxNone, BoxNone, BoxHeavy, BoxSingle), '┒') ,((BoxNone, BoxNone, BoxHeavy, BoxHeavy), '┓') ,((BoxSingle, BoxSingle, BoxNone, BoxNone), '└') ,((BoxSingle, BoxHeavy, BoxNone, BoxNone), '┕') ,((BoxHeavy, BoxSingle, BoxNone, BoxNone), '┖') ,((BoxHeavy, BoxHeavy, BoxNone, BoxNone), '┗') ,((BoxSingle, BoxNone, BoxNone, BoxSingle), '┘') ,((BoxSingle, BoxNone, BoxNone, BoxHeavy), '┙') ,((BoxHeavy, BoxNone, BoxNone, BoxSingle), '┚') ,((BoxHeavy, BoxNone, BoxNone, BoxHeavy), '┛') ,((BoxSingle, BoxSingle, BoxSingle, BoxNone), '├') ,((BoxSingle, BoxHeavy, BoxSingle, BoxNone), '┝') ,((BoxHeavy, BoxSingle, BoxSingle, BoxNone), '┞') ,((BoxSingle, BoxSingle, BoxHeavy, BoxNone), '┟') ,((BoxHeavy, BoxSingle, BoxHeavy, BoxNone), '┠') ,((BoxHeavy, BoxHeavy, BoxSingle, BoxNone), '┡') ,((BoxSingle, BoxHeavy, BoxHeavy, BoxNone), '┢') ,((BoxHeavy, BoxHeavy, BoxHeavy, BoxNone), '┣') ,((BoxSingle, BoxNone, BoxSingle, BoxSingle), '┤') ,((BoxSingle, BoxNone, BoxSingle, BoxHeavy), '┥') ,((BoxHeavy, BoxNone, BoxSingle, BoxSingle), '┦') ,((BoxSingle, BoxNone, BoxHeavy, BoxSingle), '┧') ,((BoxHeavy, BoxNone, BoxHeavy, BoxSingle), '┨') ,((BoxHeavy, BoxNone, BoxSingle, BoxHeavy), '┩') ,((BoxSingle, BoxNone, BoxHeavy, BoxHeavy), '┪') ,((BoxHeavy, BoxNone, BoxHeavy, BoxHeavy), '┫') ,((BoxNone, BoxSingle, BoxSingle, BoxSingle), '┬') ,((BoxNone, BoxSingle, BoxSingle, BoxHeavy), '┭') ,((BoxNone, BoxHeavy, BoxSingle, BoxSingle), '┮') ,((BoxNone, BoxHeavy, BoxSingle, BoxHeavy), '┯') ,((BoxNone, BoxSingle, BoxHeavy, BoxSingle), '┰') ,((BoxNone, BoxSingle, BoxHeavy, BoxHeavy), '┱') ,((BoxNone, BoxHeavy, BoxHeavy, BoxSingle), '┲') ,((BoxNone, BoxHeavy, BoxHeavy, BoxHeavy), '┳') ,((BoxSingle, BoxSingle, BoxNone, BoxSingle), '┴') ,((BoxSingle, BoxSingle, BoxNone, BoxHeavy), '┵') ,((BoxSingle, BoxHeavy, BoxNone, BoxSingle), '┶') ,((BoxSingle, BoxHeavy, BoxNone, BoxHeavy), '┷') ,((BoxHeavy, BoxSingle, BoxNone, BoxSingle), '┸') ,((BoxHeavy, BoxSingle, BoxNone, BoxHeavy), '┹') ,((BoxHeavy, BoxHeavy, BoxNone, BoxSingle), '┺') ,((BoxHeavy, BoxHeavy, BoxNone, BoxHeavy), '┻') ,((BoxSingle, BoxSingle, BoxSingle, BoxSingle), '┼') ,((BoxSingle, BoxSingle, BoxSingle, BoxHeavy), '┽') ,((BoxSingle, BoxHeavy, BoxSingle, BoxSingle), '┾') ,((BoxSingle, BoxHeavy, BoxSingle, BoxHeavy), '┿') ,((BoxHeavy, BoxSingle, BoxSingle, BoxSingle), '╀') ,((BoxSingle, BoxSingle, BoxHeavy, BoxSingle), '╁') ,((BoxHeavy, BoxSingle, BoxHeavy, BoxSingle), '╂') ,((BoxHeavy, BoxSingle, BoxSingle, BoxHeavy), '╃') ,((BoxHeavy, BoxHeavy, BoxSingle, BoxSingle), '╄') ,((BoxSingle, BoxSingle, BoxHeavy, BoxHeavy), '╅') ,((BoxSingle, BoxHeavy, BoxHeavy, BoxSingle), '╆') ,((BoxHeavy, BoxHeavy, BoxSingle, BoxHeavy), '╇') ,((BoxSingle, BoxHeavy, BoxHeavy, BoxHeavy), '╈') ,((BoxHeavy, BoxSingle, BoxHeavy, BoxHeavy), '╉') ,((BoxHeavy, BoxHeavy, BoxHeavy, BoxSingle), '╊') ,((BoxHeavy, BoxHeavy, BoxHeavy, BoxHeavy), '╋') ,((BoxNone, BoxDouble, BoxNone, BoxDouble), '═') ,((BoxDouble, BoxNone, BoxDouble, BoxNone), '║') ,((BoxNone, BoxDouble, BoxSingle, BoxNone), '╒') ,((BoxNone, BoxSingle, BoxDouble, BoxNone), '╓') ,((BoxNone, BoxDouble, BoxDouble, BoxNone), '╔') ,((BoxNone, BoxNone, BoxSingle, BoxDouble), '╕') ,((BoxNone, BoxNone, BoxDouble, BoxSingle), '╖') ,((BoxNone, BoxNone, BoxDouble, BoxDouble), '╗') ,((BoxSingle, BoxDouble, BoxNone, BoxNone), '╘') ,((BoxDouble, BoxSingle, BoxNone, BoxNone), '╙') ,((BoxDouble, BoxDouble, BoxNone, BoxNone), '╚') ,((BoxSingle, BoxNone, BoxNone, BoxDouble), '╛') ,((BoxDouble, BoxNone, BoxNone, BoxSingle), '╜') ,((BoxDouble, BoxNone, BoxNone, BoxDouble), '╝') ,((BoxSingle, BoxDouble, BoxSingle, BoxNone), '╞') ,((BoxDouble, BoxSingle, BoxDouble, BoxNone), '╟') ,((BoxDouble, BoxDouble, BoxDouble, BoxNone), '╠') ,((BoxSingle, BoxNone, BoxSingle, BoxDouble), '╡') ,((BoxDouble, BoxNone, BoxDouble, BoxSingle), '╢') ,((BoxDouble, BoxNone, BoxDouble, BoxDouble), '╣') ,((BoxNone, BoxDouble, BoxSingle, BoxDouble), '╤') ,((BoxNone, BoxSingle, BoxDouble, BoxSingle), '╥') ,((BoxNone, BoxDouble, BoxDouble, BoxDouble), '╦') ,((BoxSingle, BoxDouble, BoxNone, BoxDouble), '╧') ,((BoxDouble, BoxSingle, BoxNone, BoxSingle), '╨') ,((BoxDouble, BoxDouble, BoxNone, BoxDouble), '╩') ,((BoxSingle, BoxDouble, BoxSingle, BoxDouble), '╪') ,((BoxDouble, BoxSingle, BoxDouble, BoxSingle), '╫') ,((BoxDouble, BoxDouble, BoxDouble, BoxDouble), '╬')]