restrict_idx_1 :: [(Int,Int)] -> Maybe Grid -> Maybe Grid restrict_idx_1 _ Nothing = Nothing restrict_idx_1 idxs grid = foldl f grid idxs where f (Just g) (x,y) --| Maybe.isNothing (Maybe g) = Nothing | Set.size s == 1 = Just g | Set.size s > 1 = Just $ set g x y $ Set.difference s (paigas idxs g) | otherwise = Nothing where s = get g x y paigas idxs grid = foldl f Set.empty idxs where f s (x,y) | Set.size s2 == 1 = Set.union s s2 | otherwise = s -- todo where s2 = get grid x y