Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. type family exercise (i...@maximka.de) ---------------------------------------------------------------------- Message: 1 Date: Fri, 29 Dec 2017 16:52:10 +0100 (CET) From: i...@maximka.de To: beginners@haskell.org Subject: [Haskell-beginners] type family exercise Message-ID: <2092666003.437685.1514562730...@communicator.strato.de> Content-Type: text/plain; charset=UTF-8 There is a little exercise at the end of the post "Type Tac Toe: Advanced Type Safety" http://chrispenner.ca/posts/type-tac-toe > As an exercise try combining playX and playO into a more general play! > Here's a hint, you'll want to make another wrapper type like we did with > Coord! Link to the code https://github.com/ChrisPenner/Type-Tac-Toe/blob/master/src/TypeTacToe.hs Unfortunately I couldn't solve it by myself. The only generalised play I could implement is here: play :: (Played x y b ~ 'False) => (Coord x, Coord y) -> Board b PieceT -> PieceT -> Board b PieceT play (coordVal -> x, coordVal -> y) (Board b) p = Board $ overTrip y (overTrip x (const p)) b I would be very grateful for any help to solve the exercise by using type family extension. Regards, Alexei ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 114, Issue 27 ******************************************