Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
Just hid it myself as well. Not sure what changed---perhaps an updated version of Hspec. It appears to work now, let me know if the situation changes.
I added a paragraph which I hope helps clarify a bit. I'm glad you enjoyed the kata! I probably will make more in time :)
There's a lot to analyze, to be completely fair. i would suggest reading some material on more basic formulations of lenses to see better how this one comes to be.
But that said, type-tetris level understanding is where I personally began understanding this material as well, so it's a meaningful first step.
Yep! It does little more than allow us to define new
instance
s which differ from the inner type.Precisely.
Ah, ah! Sorry, I didn't mean to appear defensive.
I agree that this is a good example of how types can express a fairly complete picture of semantics! It makes for a lovely example for that reason.
And if you're not interested in the whole paper, I'd recommend Oleg's website which contains much of the same information but is more example driven.
I'm not sure what you're asking.
Yes, this example is from the paper. If you like you can simply play type tetris and cobble the code together without understanding it.
But if you're going to go that way then you're clearly skipping steps in understanding. I'd suggest reading the paper in earnest.
I'd definitely encourage you to keep looking. There is a much nicer way to do this still lurking :)
You can recover the meaning from the test cases. It's difficult to describe them without giving away exactly the implementation.
Added one! Thanks for the suggestion!
You're on point in noting that
Nothing
ought to capture things likeInfinity
which are represented in theDouble
type and pull them up to theMaybe
enclosing the double.The trick is to note exactly when these "exceptions" could arise. In particular, the
Infinity
inex3
arises when we divide1
by0
. SinceDagger
internalizes division usingDivide
, you'll want to focus on what happens when we callinterp (Divide a b)
. In particular, how can you detect whenb :: Dagger
represents0
?I'm intentionally a little vague around that. You can read the idea that "
interp
breaks down what we have built" by thinking about the tail end of its type:Phalanx -> String
. If you haven't done the razor and dagger language kata yet then they hopefully build that intuition.The other reason I am intentionally a little vague here is because there are two ways to solve the
rep
bit and if you end up going down one path and then notice the other you'll be forced to consider something really interesting about DSLs/embedded languages likePhalanx
: the idea of a basis encoding.This comment is hidden because it contains spoiler information about the solution
Empty should produce the empty string. Nothing is reserved for actual interpretation failures. Rep can work that way if you like, can you formulate a set of laws about the behavior of
interp
which prove it?Both fixed! Thanks again
Loading more items...