Send Beginners mailing list submissions to
[email protected]
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
[email protected]
You can reach the person managing the list at
[email protected]
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 ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 29 Dec 2017 16:52:10 +0100 (CET)
From: [email protected]
To: [email protected]
Subject: [Haskell-beginners] type family exercise
Message-ID: <[email protected]>
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
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
------------------------------
End of Beginners Digest, Vol 114, Issue 27
******************************************