module Game.Chess.Tree (positionTree, positionForest, plyTree, plyForest) where import Data.Tree (Forest, Tree (Node)) import Game.Chess.Internal positionTree :: Position -> Tree Position positionTree :: Position -> Tree Position positionTree Position pos = Position -> [Tree Position] -> Tree Position forall a. a -> [Tree a] -> Tree a Node Position pos ([Tree Position] -> Tree Position) -> [Tree Position] -> Tree Position forall a b. (a -> b) -> a -> b $ Position -> [Tree Position] positionForest Position pos positionForest :: Position -> Forest Position positionForest :: Position -> [Tree Position] positionForest Position pos = Position -> Tree Position positionTree (Position -> Tree Position) -> (Ply -> Position) -> Ply -> Tree Position forall b c a. (b -> c) -> (a -> b) -> a -> c . Position -> Ply -> Position unsafeDoPly Position pos (Ply -> Tree Position) -> [Ply] -> [Tree Position] forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Position -> [Ply] legalPlies Position pos plyForest :: Position -> Forest Ply plyForest :: Position -> Forest Ply plyForest Position pos = Position -> Ply -> Tree Ply plyTree Position pos (Ply -> Tree Ply) -> [Ply] -> Forest Ply forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> Position -> [Ply] legalPlies Position pos plyTree :: Position -> Ply -> Tree Ply plyTree :: Position -> Ply -> Tree Ply plyTree Position pos Ply ply = Ply -> Forest Ply -> Tree Ply forall a. a -> [Tree a] -> Tree a Node Ply ply (Forest Ply -> Tree Ply) -> (Position -> Forest Ply) -> Position -> Tree Ply forall b c a. (b -> c) -> (a -> b) -> a -> c . Position -> Forest Ply plyForest (Position -> Tree Ply) -> Position -> Tree Ply forall a b. (a -> b) -> a -> b $ Position -> Ply -> Position unsafeDoPly Position pos Ply ply