put margins on Hamming widget
This commit is contained in:
@@ -24,6 +24,8 @@ License along with this program. If not, see
|
||||
|
||||
|-}
|
||||
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
|
||||
module Hamming.App.Widgets.Internal (hammingW') where
|
||||
|
||||
import Data.Bits ((.&.))
|
||||
@@ -33,6 +35,15 @@ import Hamming.App.Types
|
||||
|
||||
hammingW' :: AppState -> [[([String], Char)]]
|
||||
hammingW' state = let
|
||||
header = ([], ' ') : map (["margin"],) ['0'..'3']
|
||||
body = hammingBody state
|
||||
in header : zipWith
|
||||
(\n row -> (["margin"], n) : row)
|
||||
['0'..'3']
|
||||
body
|
||||
|
||||
hammingBody :: AppState -> [[([String], Char)]]
|
||||
hammingBody state = let
|
||||
code = state^.hammingCode
|
||||
in map
|
||||
( map
|
||||
|
||||
Reference in New Issue
Block a user