Ad
  • Default User Avatar

    For some reason fixing the Countable instance for Const got rid of the problem. I wouldn't have thought the two were related.

  • Default User Avatar

    The tests seem to be saying that ((), Void) has a count of 1 (expected S Z, got Z). Unless I'm mistaken, there is no instance of ((), Void).

    I've also had my code fail on ((), Bool), stating that the count should be 3. But there should only be two instances of this type: ((), True) and ((), False).

    Edit: This is in the tests for Listable.

  • Custom User Avatar

    Fixed by @dram

  • Custom User Avatar
  • Custom User Avatar

    Needs update to GHC 9.2.x

    Compilation now gives type errors

  • Custom User Avatar

    Needs updating to GHC 9.2.x.

    Compilation now fails with horrible type errors. I can't fix it, sorry :/

  • Default User Avatar

    TL;DR: Look at the lambda calculus definition of church_pow - (ce cb) f x.
    Functions inside brackets are composed ; functions on the outside are just parameters for the previous function.
    You can translate this definition into this resulting call ce(cb)(f)(x).
    You can leave out each parameter that is not included inside brackets.
    The same goes for church_mul: c1 (c2 f) x becomes c1(c2(f))(x), meaning you can leave out the x.

  • Default User Avatar

    Hi - as someone who also discovered this area recently and who found it really interesting, I can highly recommend the following 2 videos that were linked to me in the Codewars Discord:

    https://www.youtube.com/watch?v=3VQ382QG-y4

    and

    https://www.youtube.com/watch?v=pAnLQ9jwN-E

    They use JavaScript rather than Python but it's very understandable.

  • Custom User Avatar

    Why were you able to leave out (f)(x) on church_pow and it still worked? Still trying to fully wrap my head around this concept, thx.

  • Custom User Avatar

    Ugh. This is such a "what was the author thinking?" type of problem. Yes, yes, now that I have already figured out what the author was thinking, I can see how it makes sense. But there is no information at all about what all this Count machinery is about. The description flat out gives up and just says "(see code)" and then the code just spews a bunch of declarations in comments without explaining what they are intended to mean. The given classes could just as well be implemented as count = Count 42 for all we can tell. The fact that those definitions are actually incorrect (classes are missing type params), and the real definitions are hidden in a module that we cannot read, makes it even worse. So then you look at the test cases, in hopes they might explain what was intended. But no, the test case there just says that challenge1 should be count1, without any explanation of what either one means.

    I understand there are interesting ideas embedded in this kata. But at some point, you do have to tell people something about what they are supposed to be trying to accomplish!

  • Custom User Avatar

    I don't know if CW used to not have a dark mode, but currently the image in the description is very hard to see (Black on Grey).

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Added it, btw is there something like spoiler tag to make it collapsed initially and not clutter up description?

  • Custom User Avatar

    Please put the full Preloaded in the description instead ;-)

  • Custom User Avatar

    No, it is not abuse of logic: fix (S . (* Z)) should have 1 === S Z as fixpoint, because
    S . (* Z) $ S Z = S Z (1 + 1 * 0 = 1); and your definition successfully yields it for fix (S . (Z *)) = S Z.

  • Loading more items...