main = Mate.Start Mate.Start = Mate.solveProblem (Flite.Pair (Mate.Board (Flite.Cons (Flite.Pair Mate.Knight (Flite.Pair 7 8)) (Flite.Cons (Flite.Pair Mate.Rook (Flite.Pair 5 7)) (Flite.Cons (Flite.Pair Mate.King (Flite.Pair 8 7)) (Flite.Cons (Flite.Pair Mate.Bishop (Flite.Pair 4 5)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 8 4)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 7 3)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 5 2)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 6 2)) (Flite.Cons (Flite.Pair Mate.Queen (Flite.Pair 5 1)) Flite.Nil))))))))) (Flite.Cons (Flite.Pair Mate.Knight (Flite.Pair 2 8)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 7 7)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 4 6)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 3 5)) (Flite.Cons (Flite.Pair Mate.King (Flite.Pair 6 5)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 8 5)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 4 4)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 2 3)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 5 3)) (Flite.Cons (Flite.Pair Mate.Pawn (Flite.Pair 7 2)) (Flite.Cons (Flite.Pair Mate.Queen (Flite.Pair 1 1)) (Flite.Cons (Flite.Pair Mate.Knight (Flite.Pair 2 1)) (Flite.Cons (Flite.Pair Mate.Bishop (Flite.Pair 8 1)) Flite.Nil)))))))))))))) (Flite.Pair Mate.White 3)) :: Mate.Colour = Mate.Black | Mate.White :: Flite.Pair = Flite.Pair a1 a2 :: Flite.List = Flite.Nil | Flite.Cons a1 a2 :: Mate.Kind = Mate.King | Mate.Queen | Mate.Rook | Mate.Bishop | Mate.Knight | Mate.Pawn :: Mate.Board = Mate.Board a1 a2 Mate.solveProblem !_x_0 = select _x_0 (Flite.Pair bd_1_0 _x_1_1 -> select _x_1_1 (Flite.Pair c_2_0 n_2_1 -> Mate.solve bd_1_0 c_2_0 n_2_1) ) Mate.solve !bd_0 !c_1 n_2 = Mate.showResult (Mate.solution bd_0 c_1 (sub (add n_2 n_2) 1)) Mate.solution !bd_0 !c_1 n_2 = Mate.foldr (Mate.solnOr c_1 n_2) Flite.Nothing (Mate.moveDetailsFor c_1 bd_0) Mate.moveDetailsFor !c_0 !bd_1 = Mate.concatMap (Mate.movesForPiece c_0 bd_1) (Mate.forcesColoured c_0 bd_1) Mate.forcesColoured !_x_0 !_x_1 = select _x_0 (Mate.White -> select _x_1 (Mate.Board wkss_2_0 bkss_2_1 -> wkss_2_0) ) (Mate.Black -> select _x_1 (Mate.Board wkss_2_0 bkss_2_1 -> bkss_2_1) ) Mate.movesForPiece c_0 bd_1 !p_2 = Mate.concatMap (Mate.tryMove c_0 bd_1 p_2) (Mate.rawmoves c_0 p_2 bd_1) Mate.rawmoves c_0 !_x_1 bd_2 = select _x_1 (Flite.Pair k_1_0 sq_1_1 -> <{Mate._c;169;15_142}> k_1_0 c_0 sq_1_1 bd_2) <{Mate._c;169;15_142}> !k_0 = select k_0 (Mate.King -> Mate.kingmoves) (Mate.Queen -> Mate.queenmoves) (Mate.Rook -> Mate.rookmoves) (Mate.Bishop -> Mate.bishopmoves) (Mate.Knight -> Mate.knightmoves) (Mate.Pawn -> Mate.pawnmoves) Mate.pawnmoves c_0 !_x_1 !bd_2 = select _x_1 (Flite.Pair p_1_0 q_1_1 -> let fwd_2_0 = <{Mate._c;238;16_134}> c_0, on1_2_1 = Flite.Pair p_1_0 (add q_1_1 fwd_2_0) in Mate.append (<{Mate._c;245;16_136}> (Mate.no (Mate.pieceAt bd_2 on1_2_1)) p_1_0 q_1_1 fwd_2_0 c_0 on1_2_1 bd_2) (Mate.append (Mate.promoteCap c_0 (Flite.Pair (add p_1_0 1) (add q_1_1 fwd_2_0)) bd_2) (Mate.promoteCap c_0 (Flite.Pair (sub p_1_0 1) (add q_1_1 fwd_2_0)) bd_2))) Mate.promoteCap c_0 sq_1 !bd_2 = let mcp_1_0 = Mate.pieceAt bd_2 sq_1 in <{Mate._c;260;3_133}> mcp_1_0 c_0 sq_1 <{Mate._c;260;3_133}> !mcp_0 c_1 sq_2 = select mcp_0 (Flite.Nothing -> Flite.Nil) (Flite.Just p_1_0 -> <{Mate._c;262;15_132}> (Mate.sameColour (Mate.colourOf p_1_0) c_1) c_1 sq_2 mcp_0) Mate.colourOf !_x_0 = select _x_0 (Flite.Pair c_1_0 k_1_1 -> c_1_0) Mate.sameColour !_x_0 !_x_1 = select _x_0 (Mate.White -> select _x_1 (Mate.White -> True) (Mate.Black -> False) ) (Mate.Black -> select _x_1 (Mate.White -> False) (Mate.Black -> True) ) <{Mate._c;262;15_132}> !_x_0 c_1 sq_2 mcp_3 = if (eq _x_0 False) (Mate.promote c_1 sq_2 mcp_3) (if (eq _x_0 True) Flite.Nil nomatch) Mate.promote !c_0 !sq_1 mcp_2 = if (Mate.lastRank c_0 (Mate.rank sq_1)) (Mate.map (Mate.Move sq_1 mcp_2) (Flite.Cons (Flite.Just (Flite.Pair c_0 Mate.Queen)) (Flite.Cons (Flite.Just (Flite.Pair c_0 Mate.Rook)) (Flite.Cons (Flite.Just (Flite.Pair c_0 Mate.Bishop)) (Flite.Cons (Flite.Just (Flite.Pair c_0 Mate.Knight)) Flite.Nil))))) (Flite.Cons (Mate.Move sq_1 mcp_2 Flite.Nothing) Flite.Nil) :: Flite.Maybe = Flite.Nothing | Flite.Just a1 :: Mate.Move = Mate.Move a1 a2 a3 Mate.map f_0 !_x_1 = select _x_1 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> Flite.Cons (f_0 x_1_0) (Mate.map f_0 xs_1_1)) Mate.rank !_x_0 = select _x_0 (Flite.Pair f_1_0 r_1_1 -> r_1_1) Mate.lastRank !_x_0 !r_1 = select _x_0 (Mate.White -> eq r_1 8) (Mate.Black -> eq r_1 1) Mate.pieceAt !_x_0 sq_1 = select _x_0 (Mate.Board wkss_1_0 bkss_1_1 -> Mate.pieceAtWith_103 sq_1 Mate.White (Mate.pieceAtWith_103 sq_1 Mate.Black Flite.Nothing bkss_1_1) wkss_1_0) Mate.pieceAtWith_103 sq_0 c_1 n_2 !_x_3 = select _x_3 (Flite.Nil -> n_2) (Flite.Cons _x_1_0 xs_1_1 -> select _x_1_0 (Flite.Pair k_2_0 s_2_1 -> if (Mate.sameSquare_104 s_2_1 sq_0) (Flite.Just (Flite.Pair c_1 k_2_0)) (Mate.pieceAtWith_103 sq_0 c_1 n_2 xs_1_1)) ) Mate.sameSquare_104 !_x_0 !_x_1 = select _x_0 (Flite.Pair f1_1_0 r1_1_1 -> select _x_1 (Flite.Pair f2_2_0 r2_2_1 -> Mate.con (eq f1_1_0 f2_2_0) (eq r1_1_1 r2_2_1)) ) Mate.con !_x_0 q_1 = if _x_0 q_1 False Mate.append !_x_0 ys_1 = select _x_0 (Flite.Nil -> ys_1) (Flite.Cons x_1_0 xs_1_1 -> Flite.Cons x_1_0 (Mate.append xs_1_1 ys_1)) Mate.no !_x_0 = select _x_0 (Flite.Nothing -> True) (Flite.Just x_1_0 -> False) <{Mate._c;245;16_136}> !_x_0 p_1 q_2 fwd_3 c_4 on1_5 bd_6 = if (eq _x_0 True) (let on2_1_0 = Flite.Pair p_1 (add (add q_2 fwd_3) fwd_3) in Mate.append (Mate.promote c_4 on1_5 Flite.Nothing) (<{Mate._c;241;16_135}> (Mate.con (Mate.secondRank c_4 q_2) (Mate.no (Mate.pieceAt bd_6 on2_1_0))) on2_1_0)) (if (eq _x_0 False) Flite.Nil nomatch) Mate.secondRank !_x_0 !r_1 = select _x_0 (Mate.White -> eq r_1 2) (Mate.Black -> eq r_1 7) <{Mate._c;241;16_135}> !_x_0 on2_1 = if (eq _x_0 True) (Flite.Cons (Mate.Move on2_1 Flite.Nothing Flite.Nothing) Flite.Nil) (if (eq _x_0 False) Flite.Nil nomatch) <{Mate._c;238;16_134}> !c_0 = select c_0 (Mate.White -> 1) (Mate.Black -> sub 0 1) Mate.knightmoves c_0 !_x_1 bd_2 = select _x_1 (Flite.Pair p_1_0 q_1_1 -> let pd_2_0 = sub p_1_0 1, qi2_2_1 = add q_1_1 2, pi_2_2 = add p_1_0 1, pd2_2_3 = sub p_1_0 2, qi_2_4 = add q_1_1 1, pi2_2_5 = add p_1_0 2, qd_2_6 = sub q_1_1 1, qd2_2_7 = sub q_1_1 2 in Mate.sift c_0 bd_2 Flite.Nil (Flite.Cons (Flite.Pair pd_2_0 qi2_2_1) (Flite.Cons (Flite.Pair pi_2_2 qi2_2_1) (Flite.Cons (Flite.Pair pd2_2_3 qi_2_4) (Flite.Cons (Flite.Pair pi2_2_5 qi_2_4) (Flite.Cons (Flite.Pair pd2_2_3 qd_2_6) (Flite.Cons (Flite.Pair pi2_2_5 qd_2_6) (Flite.Cons (Flite.Pair pd_2_0 qd2_2_7) (Flite.Cons (Flite.Pair pi_2_2 qd2_2_7) Flite.Nil))))))))) Mate.sift c_0 bd_1 ms_2 !_x_3 = select _x_3 (Flite.Nil -> ms_2) (Flite.Cons sq_1_0 sqs_1_1 -> <{Mate._c;225;5_138}> (Mate.onboard sq_1_0) c_0 bd_1 ms_2 sqs_1_1 sq_1_0) Mate.onboard !_x_0 = select _x_0 (Flite.Pair p_1_0 q_1_1 -> Mate.con (Mate.con (<{Mate.<=_107}> 1 p_1_0) (<{Mate.<=_108}> p_1_0 8)) (Mate.con (<{Mate.<=_109}> 1 q_1_1) (<{Mate.<=_110}> q_1_1 8))) <{Mate.<=_110}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_109}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_108}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_107}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate._c;225;5_138}> !_x_0 c_1 bd_2 ms_3 !sqs_4 sq_5 = if (eq _x_0 False) (Mate.sift c_1 bd_2 ms_3 sqs_4) (if (eq _x_0 True) (<{Mate._c;228;5_137}> (Mate.pieceAt bd_2 sq_5) c_1 bd_2 sq_5 ms_3 sqs_4) nomatch) <{Mate._c;228;5_137}> !_x_0 c_1 bd_2 sq_3 ms_4 !sqs_5 = select _x_0 (Flite.Nothing -> Mate.sift c_1 bd_2 (Flite.Cons (Mate.Move sq_3 Flite.Nothing Flite.Nothing) ms_4) sqs_5) (Flite.Just p_1_0 -> if (Mate.sameColour (Mate.colourOf p_1_0) c_1) (Mate.sift c_1 bd_2 ms_4 sqs_5) (Mate.sift c_1 bd_2 (Flite.Cons (Mate.Move sq_3 (Flite.Just p_1_0) Flite.Nothing) ms_4) sqs_5)) Mate.bishopmoves c_0 !sq_1 bd_2 = Mate.append (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.decr Mate.incr))) (Mate.append (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.incr Mate.incr))) (Mate.append (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.decr Mate.decr))) (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.incr Mate.decr))))) Mate.decr !n_0 = sub n_0 1 Mate.incr !n_0 = add n_0 1 Mate.cross !_x_0 !_x_1 = select _x_0 (Flite.Pair f_1_0 g_1_1 -> select _x_1 (Flite.Pair x_2_0 y_2_1 -> Flite.Pair (f_1_0 x_2_0) (g_1_1 y_2_1)) ) Mate.moveLine bd_0 c_1 sq_2 !incr_3 = let incrsq_1_0 = incr_3 sq_2 in <{Mate._c;193;5_141}> (Mate.onboard incrsq_1_0) bd_0 incrsq_1_0 c_1 incr_3 <{Mate._c;193;5_141}> !_x_0 bd_1 incrsq_2 c_3 incr_4 = if (eq _x_0 True) (<{Mate._c;194;11_140}> (Mate.pieceAt bd_1 incrsq_2) incrsq_2 bd_1 c_3 incr_4) (if (eq _x_0 False) Flite.Nil nomatch) <{Mate._c;194;11_140}> !_x_0 incrsq_1 bd_2 c_3 incr_4 = select _x_0 (Flite.Nothing -> Flite.Cons (Mate.Move incrsq_1 Flite.Nothing Flite.Nothing) (Mate.moveLine bd_2 c_3 incrsq_1 incr_4)) (Flite.Just p_1_0 -> <{Mate._c;197;26_139}> (Mate.sameColour (Mate.colourOf p_1_0) c_3) incrsq_1 p_1_0) <{Mate._c;197;26_139}> !_x_0 incrsq_1 p_2 = if (eq _x_0 False) (Flite.Cons (Mate.Move incrsq_1 (Flite.Just p_2) Flite.Nothing) Flite.Nil) (if (eq _x_0 True) Flite.Nil nomatch) Mate.rookmoves c_0 !sq_1 bd_2 = Mate.append (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.decr Mate.id))) (Mate.append (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.incr Mate.id))) (Mate.append (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.id Mate.decr))) (Mate.moveLine bd_2 c_0 sq_1 (Mate.cross (Flite.Pair Mate.id Mate.incr))))) Mate.id !x_0 = x_0 Mate.queenmoves c_0 !sq_1 bd_2 = Mate.append (Mate.bishopmoves c_0 sq_1 bd_2) (Mate.rookmoves c_0 sq_1 bd_2) Mate.kingmoves c_0 !_x_1 bd_2 = select _x_1 (Flite.Pair p_1_0 q_1_1 -> let pd_2_0 = sub p_1_0 1, qi_2_1 = add q_1_1 1, pi_2_2 = add p_1_0 1, qd_2_3 = sub q_1_1 1 in Mate.sift c_0 bd_2 Flite.Nil (Flite.Cons (Flite.Pair pd_2_0 qi_2_1) (Flite.Cons (Flite.Pair p_1_0 qi_2_1) (Flite.Cons (Flite.Pair pi_2_2 qi_2_1) (Flite.Cons (Flite.Pair pd_2_0 q_1_1) (Flite.Cons (Flite.Pair pi_2_2 q_1_1) (Flite.Cons (Flite.Pair pd_2_0 qd_2_3) (Flite.Cons (Flite.Pair p_1_0 qd_2_3) (Flite.Cons (Flite.Pair pi_2_2 qd_2_3) Flite.Nil))))))))) Mate.tryMove !c_0 !bd_1 !_x_2 !_x_3 = select _x_2 (Flite.Pair k_1_0 sqFrom_1_1 -> select _x_3 (Mate.Move sqTo_2_0 mcp_2_1 mpp_2_2 -> let p_3_0 = Flite.Pair c_0 k_1_0, pp_3_1 = Mate.maybe p_3_0 Mate.id mpp_2_2, bd1_3_2 = Mate.rmPieceAt c_0 sqFrom_1_1 bd_1, bd2_3_3 = Mate.maybe (Mate.putPieceAt sqTo_2_0 pp_3_1 bd1_3_2) (Mate.const (Mate.putPieceAt sqTo_2_0 pp_3_1 (Mate.rmPieceAt (Mate.opponent c_0) sqTo_2_0 bd1_3_2))) mcp_2_1 in <{Mate._c;163;8_145}> (Mate.kingincrheck c_0 bd2_3_3) p_3_0 sqFrom_1_1 sqTo_2_0 mcp_2_1 mpp_2_2 bd2_3_3) ) Mate.kingincrheck !c_0 !bd_1 = Mate.any (Mate.kingInCheckFrom c_0 bd_1) (Mate.forcesColoured (Mate.opponent c_0) bd_1) Mate.opponent !_x_0 = select _x_0 (Mate.Black -> Mate.White) (Mate.White -> Mate.Black) Mate.kingInCheckFrom !c_0 !bd_1 !_x_2 = select _x_2 (Flite.Pair f_1_0 _x_1_1 -> select _x_1_1 (Flite.Pair x_2_0 y_2_1 -> <{Mate._c;290;3_144}> (Mate.kingSquare c_0 bd_1) f_1_0 x_2_0 y_2_1 c_0 bd_1) ) Mate.kingSquare !c_0 !b_1 = Mate.kSq (Mate.forcesColoured c_0 b_1) Mate.kSq !_x_0 = select _x_0 (Flite.Cons _x_1_0 kss_1_1 -> select _x_1_0 (Flite.Pair k_2_0 s_2_1 -> if (Mate.isKing k_2_0) s_2_1 (Mate.kSq kss_1_1)) ) Mate.isKing !k_0 = eq (Mate.kindToChar k_0) (Flite.char 'K') Flite.char !c_0 = toInt_char c_0 Mate.kindToChar !k_0 = <{Mate._c;78;5_127}> k_0 <{Mate._c;78;5_127}> !k_0 = select k_0 (Mate.King -> Flite.char 'K') (Mate.Queen -> Flite.char 'Q') (Mate.Rook -> Flite.char 'R') (Mate.Bishop -> Flite.char 'B') (Mate.Knight -> Flite.char 'N') (Mate.Pawn -> Flite.char 'P') <{Mate._c;290;3_144}> !_x_0 !f_1 !x_2 y_3 c_4 bd_5 = select _x_0 (Flite.Pair xk_1_0 yk_1_1 -> <{Mate._c;292;5_143}> f_1 x_2 xk_1_0 y_3 yk_1_1 c_4 bd_5) <{Mate._c;292;5_143}> !f_0 !x_1 xk_2 y_3 yk_4 c_5 bd_6 = select f_0 (Mate.King -> Mate.con (<{Mate.<=_121}> (Mate.absn (sub x_1 xk_2)) 1) (<{Mate.<=_122}> (Mate.absn (sub y_3 yk_4)) 1)) (Mate.Queen -> Mate.dis (Mate.kingInCheckFrom c_5 bd_6 (Flite.Pair Mate.Rook (Flite.Pair x_1 y_3))) (Mate.kingInCheckFrom c_5 bd_6 (Flite.Pair Mate.Bishop (Flite.Pair x_1 y_3)))) (Mate.Rook -> Mate.dis (Mate.con (eq x_1 xk_2) (Mate.emptyAtAll bd_6 (Mate.filePath_123 xk_2 y_3 yk_4))) (Mate.con (eq y_3 yk_4) (Mate.emptyAtAll bd_6 (Mate.rankPath_124 yk_4 x_1 xk_2)))) (Mate.Bishop -> Mate.dis (Mate.con (eq (sub x_1 y_3) (sub xk_2 yk_4)) (Mate.emptyAtAll bd_6 (Mate.diagPath_126 Mate.minius_125 (sub xk_2 yk_4) x_1 xk_2))) (Mate.con (eq (add x_1 y_3) (add xk_2 yk_4)) (Mate.emptyAtAll bd_6 (Mate.diagPath_126 Mate.plus_100 (add xk_2 yk_4) x_1 xk_2)))) (Mate.Knight -> Mate.dis (Mate.con (eq (Mate.absn (sub x_1 xk_2)) 2) (eq (Mate.absn (sub y_3 yk_4)) 1)) (Mate.con (eq (Mate.absn (sub x_1 xk_2)) 1) (eq (Mate.absn (sub y_3 yk_4)) 2))) (Mate.Pawn -> Mate.con (eq (Mate.absn (sub x_1 xk_2)) 1) (eq yk_4 (Mate.onFor c_5 y_3))) Mate.onFor !_x_0 = select _x_0 (Mate.Black -> Mate.incr) (Mate.White -> Mate.decr) Mate.absn !n_0 = if (<{Mate.<=_99}> 0 n_0) n_0 (sub 0 n_0) <{Mate.<=_99}> !x_0 !y_1 = not (lt y_1 x_0) Mate.dis !_x_0 q_1 = if _x_0 True q_1 Mate.plus_100 !a_0 !b_1 = add a_0 b_1 Mate.diagPath_126 !op_0 !d_1 xFrom_2 xTo_3 !_x_4 = select _x_4 (Flite.Pair x_1_0 y_1_1 -> Mate.con (eq (op_0 x_1_0 y_1_1) d_1) (Mate.con (<{Mate.<=_115}> (add (Mate.mini_111 xFrom_2 xTo_3) 1) x_1_0) (<{Mate.<=_116}> x_1_0 (sub (Mate.maxi_113 xFrom_2 xTo_3) 1)))) Mate.maxi_113 !x_0 !y_1 = if (<{Mate.<=_114}> x_0 y_1) y_1 x_0 <{Mate.<=_114}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_116}> !x_0 !y_1 = not (lt y_1 x_0) Mate.mini_111 !x_0 !y_1 = if (<{Mate.<=_112}> x_0 y_1) x_0 y_1 <{Mate.<=_112}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_115}> !x_0 !y_1 = not (lt y_1 x_0) Mate.emptyAtAll !_x_0 e_1 = select _x_0 (Mate.Board wkss_1_0 bkss_1_1 -> Mate.emptyAtAllAnd e_1 (Mate.emptyAtAllAnd e_1 True bkss_1_1) wkss_1_0) Mate.emptyAtAllAnd e_0 b_1 !_x_2 = select _x_2 (Flite.Nil -> b_1) (Flite.Cons _x_1_0 xs_1_1 -> select _x_1_0 (Flite.Pair k_2_0 s_2_1 -> if (e_0 s_2_1) False (Mate.emptyAtAllAnd e_0 b_1 xs_1_1)) ) Mate.minius_125 !a_0 !b_1 = sub a_0 b_1 Mate.rankPath_124 !yk_0 xFrom_1 xTo_2 !_x_3 = select _x_3 (Flite.Pair x_1_0 y_1_1 -> Mate.con (eq y_1_1 yk_0) (Mate.con (<{Mate.<=_117}> (add (Mate.mini_111 xFrom_1 xTo_2) 1) x_1_0) (<{Mate.<=_118}> x_1_0 (sub (Mate.maxi_113 xFrom_1 xTo_2) 1)))) <{Mate.<=_118}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_117}> !x_0 !y_1 = not (lt y_1 x_0) Mate.filePath_123 !xk_0 yFrom_1 yTo_2 !_x_3 = select _x_3 (Flite.Pair x_1_0 y_1_1 -> Mate.con (eq x_1_0 xk_0) (Mate.con (<{Mate.<=_119}> (add (Mate.mini_111 yFrom_1 yTo_2) 1) y_1_1) (<{Mate.<=_120}> y_1_1 (sub (Mate.maxi_113 yFrom_1 yTo_2) 1)))) <{Mate.<=_120}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_119}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_122}> !x_0 !y_1 = not (lt y_1 x_0) <{Mate.<=_121}> !x_0 !y_1 = not (lt y_1 x_0) Mate.any p_0 !_x_1 = select _x_1 (Flite.Nil -> False) (Flite.Cons x_1_0 xs_1_1 -> Mate.dis (p_0 x_1_0) (Mate.any p_0 xs_1_1)) <{Mate._c;163;8_145}> !_x_0 p_1 sqFrom_2 sqTo_3 mcp_4 mpp_5 bd2_6 = if (eq _x_0 False) (Flite.Cons (Flite.Pair (Mate.MoveInFull p_1 sqFrom_2 (Mate.Move sqTo_3 mcp_4 mpp_5)) bd2_6) Flite.Nil) (if (eq _x_0 True) Flite.Nil nomatch) :: Mate.MoveInFull = Mate.MoveInFull a1 a2 a3 Mate.rmPieceAt !_x_0 sq_1 !_x_2 = select _x_0 (Mate.White -> select _x_2 (Mate.Board wkss_2_0 bkss_2_1 -> Mate.Board (Mate.rPa_106 sq_1 wkss_2_0) bkss_2_1) ) (Mate.Black -> select _x_2 (Mate.Board wkss_2_0 bkss_2_1 -> Mate.Board wkss_2_0 (Mate.rPa_106 sq_1 bkss_2_1)) ) Mate.rPa_106 !sq_0 !_x_1 = select _x_1 (Flite.Cons ks_1_0 kss_1_1 -> <{Mate._c;110;3_130}> ks_1_0 sq_0 kss_1_1) <{Mate._c;110;3_130}> !ks_0 !sq_1 kss_2 = select ks_0 (Flite.Pair k_1_0 s_1_1 -> if (Mate.sameSquare_104 s_1_1 sq_1) kss_2 (Flite.Cons ks_0 (Mate.rPa_106 sq_1 kss_2))) Mate.putPieceAt sq_0 !_x_1 !_x_2 = select _x_1 (Flite.Pair c_1_0 k_1_1 -> select _x_2 (Mate.Board wkss_2_0 bkss_2_1 -> <{Mate._c;116;3_131}> c_1_0 k_1_1 sq_0 wkss_2_0 bkss_2_1) ) <{Mate._c;116;3_131}> !c_0 k_1 sq_2 wkss_3 bkss_4 = select c_0 (Mate.White -> Mate.Board (Flite.Cons (Flite.Pair k_1 sq_2) wkss_3) bkss_4) (Mate.Black -> Mate.Board wkss_3 (Flite.Cons (Flite.Pair k_1 sq_2) bkss_4)) Mate.const !c_0 x_1 = c_0 Mate.maybe n_0 j_1 !_x_2 = select _x_2 (Flite.Nothing -> n_0) (Flite.Just x_1_0 -> j_1 x_1_0) Mate.concatMap f_0 !_x_1 = select _x_1 (Flite.Nil -> Flite.Nil) (Flite.Cons x_1_0 xs_1_1 -> Mate.append (f_0 x_1_0) (Mate.concatMap f_0 xs_1_1)) Mate.solnOr !c_0 !n_1 !_x_2 other_3 = select _x_2 (Flite.Pair mif_1_0 b_1_1 -> <{Mate._c;334;5_146}> (Mate.replies b_1_1 (Mate.opponent c_0) (sub n_1 1)) other_3 c_0 b_1_1 mif_1_0) Mate.replies !bd_0 !c_1 !n_2 = if (eq n_2 0) (if (Mate.null (Mate.moveDetailsFor c_1 bd_0)) (Flite.Just Flite.Nil) Flite.Nothing) (Mate.foldr (Mate.solnAnd c_1 n_2) (Flite.Just Flite.Nil) (Mate.moveDetailsFor c_1 bd_0)) Mate.solnAnd !c_0 n_1 !_x_2 rest_3 = select _x_2 (Flite.Pair mif_1_0 b_1_1 -> <{Mate._c;353;5_148}> (Mate.solution b_1_1 (Mate.opponent c_0) (sub n_1 1)) rest_3 mif_1_0) <{Mate._c;353;5_148}> !_x_0 rest_1 mif_2 = select _x_0 (Flite.Nothing -> Flite.Nothing) (Flite.Just s_1_0 -> <{Mate._c;355;16_147}> rest_1 mif_2 s_1_0) <{Mate._c;355;16_147}> !rest_0 mif_1 s_2 = select rest_0 (Flite.Nothing -> Flite.Nothing) (Flite.Just ms_1_0 -> Flite.Just (Flite.Cons (Flite.Pair mif_1 s_2) ms_1_0)) Mate.foldr f_0 z_1 !_x_2 = select _x_2 (Flite.Nil -> z_1) (Flite.Cons x_1_0 xs_1_1 -> f_0 x_1_0 (Mate.foldr f_0 z_1 xs_1_1)) Mate.null !_x_0 = select _x_0 (Flite.Nil -> True) (Flite.Cons x_1_0 xs_1_1 -> False) <{Mate._c;334;5_146}> !_x_0 other_1 c_2 b_3 mif_4 = select _x_0 (Flite.Nothing -> other_1) (Flite.Just rs_1_0 -> if (Mate.null rs_1_0) (if (Mate.kingincrheck (Mate.opponent c_2) b_3) (Flite.Just (Mate.Solution mif_4 Flite.Nil)) other_1) (Flite.Just (Mate.Solution mif_4 rs_1_0))) :: Mate.Solution = Mate.Solution a1 a2 Mate.showResult !_x_0 = select _x_0 (Flite.Nothing -> 0) (Flite.Just s_1_0 -> Mate.size s_1_0) Mate.size !_x_0 = select _x_0 (Mate.Solution mif_1_0 rs_1_1 -> add 1 (Mate.sum (Mate.map Mate.size (Mate.snd (Mate.unzip rs_1_1))))) Mate.unzip !_x_0 = select _x_0 (Flite.Nil -> Flite.Pair Flite.Nil Flite.Nil) (Flite.Cons _x_1_0 xys_1_1 -> select _x_1_0 (Flite.Pair x_2_0 y_2_1 -> let u_3_0 = Mate.unzip xys_1_1 in Flite.Pair (Flite.Cons x_2_0 (Mate.fst u_3_0)) (Flite.Cons y_2_1 (Mate.snd u_3_0))) ) Mate.snd !_x_0 = select _x_0 (Flite.Pair x_1_0 y_1_1 -> y_1_1) Mate.fst !_x_0 = select _x_0 (Flite.Pair x_1_0 y_1_1 -> x_1_0) Mate.sum !xs_0 = Mate.foldr Mate.plus_100 0 xs_0