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.
'Seems you found your problem. Closing.
Nice one! Looks very clean :)
I will not approve your translation. It needs random tests and sample test cases are missing too. You can check some other katas how random test cases are created there and just follow it.
I believe you can deduce such information from this line in the Kata description:
It's a puzzle after all, right?
You can't use typedef because you can't use extra
;
in your code. It's intended as a part of this puzzle :)Once that is thrown into the mix it's almost impossible to do anti-cheats, so I'd say it's okay. It's also not too much extra effort to not use it ;-)
That's just something I wanted to write because I found this funny since I'm a pretty stupid person :-)
This comes from the Functor instance on functions defined as
implying that
fmap fmap fmap == (.) . (.)
in this context.fmap fmap fmap
's type is (usingghci
)I don't think you need to worry about the general case for this problem. In fact, I don't think you even can implement foldr for the general
Foldable a
. You need to know the value constructors for your foldable typet a
, so that you can pattern match against them when you go to write your specificFoldable a
instance fort a
.You first have to solve the kata, then you'll be able to kumit a translation.
More info there