module BishBosh.Component.EitherQualifiedMove(
EitherQualifiedMove(
getMove,
getPromotionRankOrMoveType
),
mkPartiallyQualifiedMove,
mkFullyQualifiedMove
) where
import qualified BishBosh.Attribute.MoveType as Attribute.MoveType
import qualified BishBosh.Attribute.Rank as Attribute.Rank
import qualified BishBosh.Component.Move as Component.Move
data EitherQualifiedMove x y = MkEitherQualifiedMove {
EitherQualifiedMove x y -> Move x y
getMove :: Component.Move.Move x y,
EitherQualifiedMove x y -> Either (Maybe Rank) MoveType
getPromotionRankOrMoveType :: Either (Maybe Attribute.Rank.Rank) Attribute.MoveType.MoveType
}
mkPartiallyQualifiedMove :: Component.Move.Move x y -> Maybe Attribute.Rank.Rank -> EitherQualifiedMove x y
mkPartiallyQualifiedMove :: Move x y -> Maybe Rank -> EitherQualifiedMove x y
mkPartiallyQualifiedMove Move x y
move = Move x y -> Either (Maybe Rank) MoveType -> EitherQualifiedMove x y
forall x y.
Move x y -> Either (Maybe Rank) MoveType -> EitherQualifiedMove x y
MkEitherQualifiedMove Move x y
move (Either (Maybe Rank) MoveType -> EitherQualifiedMove x y)
-> (Maybe Rank -> Either (Maybe Rank) MoveType)
-> Maybe Rank
-> EitherQualifiedMove x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe Rank -> Either (Maybe Rank) MoveType
forall a b. a -> Either a b
Left
mkFullyQualifiedMove :: Component.Move.Move x y -> Attribute.MoveType.MoveType -> EitherQualifiedMove x y
mkFullyQualifiedMove :: Move x y -> MoveType -> EitherQualifiedMove x y
mkFullyQualifiedMove Move x y
move = Move x y -> Either (Maybe Rank) MoveType -> EitherQualifiedMove x y
forall x y.
Move x y -> Either (Maybe Rank) MoveType -> EitherQualifiedMove x y
MkEitherQualifiedMove Move x y
move (Either (Maybe Rank) MoveType -> EitherQualifiedMove x y)
-> (MoveType -> Either (Maybe Rank) MoveType)
-> MoveType
-> EitherQualifiedMove x y
forall b c a. (b -> c) -> (a -> b) -> a -> c
. MoveType -> Either (Maybe Rank) MoveType
forall a b. b -> Either a b
Right