Ad
  • Custom User Avatar

    It would be nice if the declaration of interp was changed to interp :: (Name -> Maybe String) -> Phalanx -> Maybe String as the current one suggests that it receives a function (Name -> Maybe String) and returns another function (Phalanx -> Maybe String).

  • Custom User Avatar

    Needs random tests

  • Custom User Avatar

    Lacks random tests

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    The Greatest kata I have solved!

    Until this moment I can't believe these things in programming (types, classes, and so on) have so much to do with mathematics.

    Could someone tell me where (or how) to learn more about this?

  • Custom User Avatar

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

  • Custom User Avatar

    I like this kata. But I've got problem with the fact that the naive Haskell implementation of "pretty" (using ++), which has potentially quadratic complexity (and incidentally is also the way that most solutions are implemented) is promoted as best practice solution. In order to spread the word and promote good Haskell programming practices I would:

    1. add some test case which would make tests with naive implementation (using ++) fail with timeout.
      e.g:

    bigRazor = foldl f (Lit 0) [1..10000] where f r i = Add r (Lit i)
    -- and the test would for example just check the lenght of the resulting String

    1. Mention in the assignment that the naive implementation using (++) would not be accepted and point people to some simple example of the proper way to implement pretty (= basically Show instance) for Razor, e.g. https://www.haskell.org/tutorial/stdclasses.html
  • Custom User Avatar

    Could you make the Fractional and Num instances more clear? As in, 1 + 2 becomes Add (Literal 1) (Literal 2) rather than Literal 3, as I mistakenly started with?

    But complaining aside, best kata ever! Thanks, and I hope you can make more like this. May I suggest error messages with the Either monad?