<commit_before>module Board where

import Data.Ix (inRange)
import Data.Set (Set(..),notMember)

import Cell
import Unit
import Types

data Board = Board { cols :: Number, rows :: Number, fulls :: Set Cell }


valid :: Board -> Unit -> Maybe Unit
valid b u 
 = if and (map (flip notMember fs) cs) && all (inRange (cell (0,0), cell (cols b -1, rows b -1))) cs
   then Just u else Nothing
  where
    fs = fulls b
    cs = members u
<commit_msg>lockUnit :: Board -> Unit -> Board<commit_after>module Board where

import Data.Ix (inRange)
import Data.Set (Set(..))
import qualified Data.Set as Set (notMember,insert)

import Cell
import Unit
import Types

data Board = Board { cols :: Number, rows :: Number, fulls :: Set Cell }


valid :: Board -> Unit -> Maybe Unit
valid b u 
 = if and (map (flip Set.notMember fs) cs) && all (inRange (cell (0,0), cell (cols b -1, rows b -1))) cs
   then Just u else Nothing
  where
    fs = fulls b
    cs = members u

lockUnit :: Board -> Unit -> Board
lockUnit b u = b { fulls = foldr Set.insert (fulls b) (members u) }

{'fraction_non_alphanumeric': 0.1239356669820246, 'fraction_numerical': 0.007568590350047304, 'mean_word_length': 3.1818181818181817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1943068', 'n_tokens_mistral': 351, 'n_tokens_neox': 344, 'n_words': 152}