Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Puzzle grids.
- data Grid s a where
- type SGrid = Grid Square
- type CharGrid = SGrid Char
- type AreaGrid = CharGrid
- type ShadedGrid = SGrid Bool
- type CharClueGrid = SGrid (Maybe Char)
- type IntGrid = SGrid (Clue Int)
- (!) :: (GridShape s, Ord (Cell s)) => Grid s a -> Cell s -> a
- fromListList :: [[a]] -> Grid Square a
- size :: GridShape s => Grid s a -> GridSize s
- cells :: GridShape s => Grid s a -> [Cell s]
- inBounds :: (GridShape s, Eq (Cell s)) => Grid s a -> Cell s -> Bool
- clues :: GridShape s => Grid s (Maybe a) -> [(Cell s, a)]
- values :: GridShape s => Grid s a -> [(Cell s, a)]
- borders :: Eq a => Grid Square a -> [Edge]
- data OutsideClues a = OC {}
- outsideclues :: OutsideClues (Maybe a) -> [((Int, Int), a)]
Documentation
A generic grid, with the given shape and contents.
type ShadedGrid = SGrid Bool Source
type CharClueGrid = SGrid (Maybe Char) Source
(!) :: (GridShape s, Ord (Cell s)) => Grid s a -> Cell s -> a Source
Lookup a grid value at a given cell. Unsafe.
fromListList :: [[a]] -> Grid Square a Source
Initialize a square grid from a list of lists. The grid might be incomplete if some rows are shorter.
clues :: GridShape s => Grid s (Maybe a) -> [(Cell s, a)] Source
For a grid with value type Maybe a
, return an association
list of cells and Just
values.
borders :: Eq a => Grid Square a -> [Edge] Source
The inner edges of a grid that separate unequal cells.
outsideclues :: OutsideClues (Maybe a) -> [((Int, Int), a)] Source
Convert outside clues to association list mapping coordinate to value.