puzzle-draw-0.2.0.0: Creating graphics for pencil puzzles.

Safe HaskellNone
LanguageHaskell98

Text.Puzzles.Util

Synopsis

Documentation

type Path = [String] Source #

parseFrom :: Path -> (Value -> Parser b) -> Value -> Parser b Source #

class FromChar a where Source #

Minimal complete definition

parseChar

Methods

parseChar :: Char -> Parser a Source #

Instances

FromChar Char Source # 
FromChar Int Source # 
FromChar () Source # 

Methods

parseChar :: Char -> Parser () Source #

FromChar Dir' Source # 
FromChar GalaxyCentre Source # 
FromChar Relation Source # 
FromChar PlainNode Source # 
FromChar MEnd Source # 
FromChar Crossing Source # 
FromChar Star Source # 
FromChar Fish Source # 
FromChar Black Source # 
FromChar PrimeDiag Source # 
FromChar KropkiDot Source # 
FromChar SlalomDiag Source # 
FromChar MasyuPearl Source # 
FromChar Tight Source # 
FromChar Dirs' Source # 
FromChar HalfDirs Source # 
FromChar Shaded Source # 
FromChar Empty Source # 
FromChar Blank'' Source # 
FromChar Blank' Source # 
FromChar Blank Source # 
FromChar Space Source # 
FromChar Alpha Source # 
FromChar a => FromChar (Maybe a) Source # 

Methods

parseChar :: Char -> Parser (Maybe a) Source #

(FromChar a, FromChar b) => FromChar (Either a b) Source # 

Methods

parseChar :: Char -> Parser (Either a b) Source #

(FromChar a, FromChar b) => FromChar (Either' a b) Source # 

Methods

parseChar :: Char -> Parser (Either' a b) Source #

newtype Alpha Source #

Constructors

Alpha 

Fields

Instances

newtype IntString Source #

Helper to parse strings from number-formatted YAML fields. Somewhat dodgy.

Constructors

IntString 

Fields

data Rect a Source #

A rectangle. Each row has length w.

Constructors

Rect !Int !Int [[a]] 

Instances

Functor Rect Source # 

Methods

fmap :: (a -> b) -> Rect a -> Rect b #

(<$) :: a -> Rect b -> Rect a #

Show a => Show (Rect a) Source # 

Methods

showsPrec :: Int -> Rect a -> ShowS #

show :: Rect a -> String #

showList :: [Rect a] -> ShowS #

FromChar a => FromJSON (Rect a) Source # 

data Border a Source #

Constructors

Border [a] [a] [a] [a] 

Instances

Functor Border Source # 

Methods

fmap :: (a -> b) -> Border a -> Border b #

(<$) :: a -> Border b -> Border a #

Foldable Border Source #

This instance might be a lie.

Methods

fold :: Monoid m => Border m -> m #

foldMap :: Monoid m => (a -> m) -> Border a -> m #

foldr :: (a -> b -> b) -> b -> Border a -> b #

foldr' :: (a -> b -> b) -> b -> Border a -> b #

foldl :: (b -> a -> b) -> b -> Border a -> b #

foldl' :: (b -> a -> b) -> b -> Border a -> b #

foldr1 :: (a -> a -> a) -> Border a -> a #

foldl1 :: (a -> a -> a) -> Border a -> a #

toList :: Border a -> [a] #

null :: Border a -> Bool #

length :: Border a -> Int #

elem :: Eq a => a -> Border a -> Bool #

maximum :: Ord a => Border a -> a #

minimum :: Ord a => Border a -> a #

sum :: Num a => Border a -> a #

product :: Num a => Border a -> a #

Traversable Border Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Border a -> f (Border b) #

sequenceA :: Applicative f => Border (f a) -> f (Border a) #

mapM :: Monad m => (a -> m b) -> Border a -> m (Border b) #

sequence :: Monad m => Border (m a) -> m (Border a) #

Show a => Show (Border a) Source # 

Methods

showsPrec :: Int -> Border a -> ShowS #

show :: Border a -> String #

showList :: [Border a] -> ShowS #

data BorderedRect a b Source #

Constructors

BorderedRect !Int !Int [[a]] (Border b) 

newtype SpacedRect a Source #

Constructors

SpacedRect 

Fields

data Space Source #

Constructors

Space 

data Blank'' Source #

Constructors

Blank'' 

data Empty Source #

Constructors

Empty 

newtype Either' a b Source #

Constructors

Either' 

Fields

Instances

newtype Shaded Source #

Constructors

Shaded 

Fields

parseGrid :: (Key k, FromChar a) => Value -> Parser (Grid k a) Source #

parseGridWith :: Key k => (Char -> Parser a) -> Value -> Parser (Grid k a) Source #

parseExtGrid' :: (Key k, FromJSON a, FromChar b) => (a -> b) -> Value -> Parser (Grid k b) Source #

parseEdgeGrid :: (FromChar a, FromChar b, FromChar c) => Value -> Parser (Grid N a, Grid C b, Map (Edge N) c) Source #

Parse a grid with edges and values at nodes and in cells.

E.g. o-*-*-o |1|2 3 *-o to a grid of masyu pearls, a grid of integers, and some annotated edges.

parseNodeEdges :: FromChar a => Value -> Parser (Grid N a, [Edge N]) Source #

Parse a grid of edges with values at the nodes.

E.g. o-*-*-o | | *-o to a grid of masyu pearls and some edges.

data HalfDirs Source #

Constructors

HalfDirs 

Fields

newtype Dirs' Source #

Constructors

Dirs' 

Fields

partitionEithers :: Ord k => Map k (Either a b) -> (Map k a, Map k b) Source #

parseOutsideGrid :: Key k => (Char -> Parser a) -> (Char -> Parser b) -> Value -> Parser (OutsideClues k b, Grid k a) Source #

parseOutsideGridMap :: (Key k, FromChar a, FromChar b) => (a -> c) -> (b -> d) -> Value -> Parser (OutsideClues k d, Grid k c) Source #

newtype Tight Source #

Constructors

Tight 

Fields

parseDoublePair :: FromString a => Value -> Parser ((a, a), (a, a)) Source #

newtype PMarkedLine a Source #

Constructors

PML 

Fields

newtype PCompassC Source #

Constructors

PCC 

Fields

newtype RefGrid k a Source #

Constructors

RefGrid 

Fields

Instances

(Key k, FromJSON a) => FromJSON (RefGrid k a) Source # 

hashmaptomap :: Ord a => HashMap a b -> Map a b Source #

compose :: Ord b => Map a b -> Map b c -> Maybe (Map a c) Source #

newtype MaybeMap k a Source #

Constructors

MM 

Fields

Instances

Functor (MaybeMap k) Source # 

Methods

fmap :: (a -> b) -> MaybeMap k a -> MaybeMap k b #

(<$) :: a -> MaybeMap k b -> MaybeMap k a #

Foldable (MaybeMap k) Source # 

Methods

fold :: Monoid m => MaybeMap k m -> m #

foldMap :: Monoid m => (a -> m) -> MaybeMap k a -> m #

foldr :: (a -> b -> b) -> b -> MaybeMap k a -> b #

foldr' :: (a -> b -> b) -> b -> MaybeMap k a -> b #

foldl :: (b -> a -> b) -> b -> MaybeMap k a -> b #

foldl' :: (b -> a -> b) -> b -> MaybeMap k a -> b #

foldr1 :: (a -> a -> a) -> MaybeMap k a -> a #

foldl1 :: (a -> a -> a) -> MaybeMap k a -> a #

toList :: MaybeMap k a -> [a] #

null :: MaybeMap k a -> Bool #

length :: MaybeMap k a -> Int #

elem :: Eq a => a -> MaybeMap k a -> Bool #

maximum :: Ord a => MaybeMap k a -> a #

minimum :: Ord a => MaybeMap k a -> a #

sum :: Num a => MaybeMap k a -> a #

product :: Num a => MaybeMap k a -> a #

Traversable (MaybeMap k) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> MaybeMap k a -> f (MaybeMap k b) #

sequenceA :: Applicative f => MaybeMap k (f a) -> f (MaybeMap k a) #

mapM :: Monad m => (a -> m b) -> MaybeMap k a -> m (MaybeMap k b) #

sequence :: Monad m => MaybeMap k (m a) -> m (MaybeMap k a) #

compose' :: Ord b => Map a (Maybe b) -> Map b c -> Maybe (Map a (Maybe c)) Source #