put margins on Hamming widget
This commit is contained in:
1 parent
1565c1fe99
commit
7531cf192f
2 files changed
+119
-19
No files matched your search
@@ -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