1. 7

    Yay for easier & better testing. Also, I think you’ll freakin love property based testing. (If you don’t already)

    I know didly-zip about the Java biome, but I’ve no doubt you can follow your nose. :D

    1. 4

      Something I probably should have made explicit in the post is that this isn’t a Haskell specific technique. Any language with property based testing libraries can do this. Python + Hypothesis, Scala + Scalacheck, F# + Hedgehog… So have at it. :)

      1. 3

        I really really really really need to write up my property based testing for webUIs, and flesh out the POC for property based testing of reflex-frp functionality…. I keep harping on about it, people are interested, need to DoTheThing(TM).

        1. 1

          Very cool! This sort of thing is a stupid amount of fun.

          raycasting buddies : https://github.com/mankyKitty/reflex-demo-game (no guarantees on buildability ><)

          1. 6

            The post author does not mention it, but there is also Haskell Programming From First Principles which she co-authored along with Chris Allen. Many beginner learners say good things about the book. Some, like me, who appreciate concise writing found it lacking. In the end, whatever book you use - you won’t make much inroads into Haskell (or any radically new tech for that matter) without actually trying to develop projects in it. That’s how we learn. Hands-on work.

            There is also Real World Haskell. Although it is a bit outdated (but being revived by volunteers), it contains great practical recipes.

            1. 9

              Totally agree with your point about actually getting your hands dirty. Haskell is no different from any other language in that regard. You’ll get nowhere simply flirting with the language and pondering poor monad analogies.

              The post author does not mention it

              I think there’s a reason for that, though I hope this thread doesn’t descend into an argument about that bit of history.

              1. 3

                Huh, did the two coauthors of that book have a falling out after it was published? I read it myself and liked it well enough, although I found it aimed at a level of Haskell understanding a little more basic than my own at the time I read it.

                1. 5

                  Yes, though as I said I hope this thread doesn’t turn into all of us discussing it. There are statements from the authors and other discussions elsewhere, but let’s all leave it at that.

                  Instead, we can talk about Julie’s subsequent work.

                  I bought an early access copy of Finding Failure (and Success) in Haskell and I thought it was really good, especially for people new to the language. The exercises are practical, and help you understand the why behind the what. Motivating examples are so important. Otherwise, I think most people who see a tutorial like “Here’s how monad transformers work” would be like “Ok? But so what?”

                  1. 2

                    Chris Allen (the other co-author) has branched off on his own as well, looking to publish the “next in series” book titled Haskell Almanac. Sadly, however, there has been no update on this book, just as there is none on the much anticipated Intermediate Haskell. Though luckily there is Thinking in Types by the author of polysemy.

                    As I see it, Haskell lacks intermediate level books more than beginners books.

                    1. 2

                      The final release of Haskell Programming from First Principles now has the OK. I’m releasing it by the end of this month. I’ll work on the print version after that. I have a printer that can do an offset print run ready to go. Just a matter of figuring out how many I should run and how to finance it. I have a climate controlled storage unit ready for the books. I never found a suitable solution for third party logistics so my wife and I will be shipping all the print books.

                      As I see it, Haskell lacks intermediate level books more than beginners books.

                      You’re right that this is the more immediate problem now. Over 5 years ago when I started on HPFFP making sure no beginner was left behind was the more pressing issue.

                      I have work to do on https://lorepub.com before it’s ready to sell print books (~1-3 days of coding and ops work from seeing the deployment for digital sales). Once the HPFFP print version is available for sale and that situation is stable, I’ll get back to the Almanac. After the Almanac, I’ll be seeing if I can be more productively employed as a publisher than an author. I believe the process we hammered out for HPFFP can be well applied to other topics and educational goals.

              2. 4

                Speaking of getting your hands dirty… There is the https://github.com/qfpl/applied-fp-course/ where you actually build a small REST backend with Haskell. Sort of a fill in the blanks style, independent levels of increasing complexity thing. :)

                Disclaimer: I’m biased, I wrote it.

              1. 1

                Having a crack at an Adapton implementation for no reason than it seems super interesting and really quite useful. Also learning about libclang so I can generate some bindings for stb_truetype.

                1. 3

                  These are excellent, good fun, and very approachable!

                  I leaned on these when I was banging together a project of my own:

                  live: https://mankykitty.github.io/fantastic-waddle/

                  repo: https://github.com/mankyKitty/fantastic-waddle

                  Might have bit rotted since then though….

                  1. 2

                    Writing more docs and mebbe a blog post about my new Webdriver bindings for Haskell: cautious-sniffle … working title, suggestions appreciated. ;)

                    The existing bindings don’t work with selenium >= 3 and have stagnated quite a bit. It seemed like a good time to overhaul them with some more modern Haskell techniques/packages. This is intended to be the base package, providing the commands and enough types to be useful without restricting the wacky stuff people may want to do with it.

                    I’ve been wiring it up with property based state machine testing and it’s been wild, looking forward to sharing more as it all develops. :D

                    1. 3

                      Werk: Haskell bindings for the “new” W3C Webdriver protocol. Using sweeeet generic deriving shenanigans that mean I only have to write the type signature for an endpoint and the compiler does the rest. With >50 endpoints, still a bunch of work to do.

                      1. 5

                        I’ll be speaking and helping with a workshop at Lambda Jam on property-based state machine testing, spoiler: it’s freakin awesome. The conf is out of town so I have to prep the house for puppy-sitters…

                        If I have a spare moment I’ll be diving back in neural nets with some delicious graphics experiments to break things up…

                        Maybe see the sun, hash-tag ‘I regret nothing’.

                        1. 2

                          May or may not have yelled “it’s alive!” when my webdriver bindings animated the shambling horror that is a modern web browser. On to writing a bunch of fun tests and seeing about a nicer layer on top for error messages and logging.

                          I’ll be dog-fooding this a bit as I wire in the state-machine testing, should be… interesting.

                          1. 3

                            Kicking around some code-gen and machine readable definitions for the W3C WebDriver bindings. When that’s working I can start on examples and bloggenating about property-based state machine testing for web interfaces. Seems like a wicked fun kernel of an idea, will be interesting to see what falls out.

                            1. 2

                              Implementing a harness for running property-based state machine tests against a command-line application. Similar to the state machine tests for WordPress described here: https://qfpl.io/posts/intro-to-state-machine-testing-1/

                              I juuuuuust made it work too, yay! I’m able to treat the application as a black box and see if I can poke holes in it by describing various individual commands with pre/post conditions, state updates etc. The testing library then generates random but valid sequences of commands (using the pre-conditions) and tells me when and how it broke it. :D

                              1. 1

                                That’s awesome!

                                I recently tried out the python hypothesis library, it has some very durable property testing that includes nice state machine semantics (this blog post has an example). If you’re looking for inspiration on building up a nice API, I’d recommend it. Of course you can call out to CLI tools from Python

                                1. 1

                                  I’m using this delicious Haskell package -> hedgehog. It has a nice API already! :D

                                  I did notice that Hypothesis has some state machine shenanigans going on, which is very cool. Property based tests and state machine tests are so immensely useful. I’ve a few ideas that are being worked on, hopefully I have some thing more interesting to crow about in the near future!

                              1. 6

                                $doggo: Acquire pats, demand walks, nap like total queen.

                                $human_learning: Chipping away at the deep learning specialisation on Coursera. Building an Anki deck in the process and coming up with meaningful flash cards is an interesting process. Plenty of just standard drills, but I need a balance of questions that force me to think about the meaning of things. “That’s correct, but why?” shouldn’t be a sticking point, mostly.

                                $human_mental_health: Avoiding the all too common trap of belittling my own abilities when I see my coworkers do seriously cool things. Seriously, so cool.

                                1. 2

                                  Finished the Coursera course for Machine Learning, and now diving straight into the deep learning specialisation!

                                  Also going on the odd cleaning rampage, with the balcony and kitchen nations being the first to fall. evil laugh

                                  1. 3

                                    Continuing to hack on the newly released JSON lib for Haskell: Waargonaut (https://github.com/qfpl/waargonaut). Have to clean up the error messages a bit, and add some extra sauce to the API. It’s coming together nicely, but I need more users to help me really streamline the API.

                                    Working through the Coursera course on Machine Learning. It is a spectacular course so far and I’m learning heaps. It’s all a bit of an uphill battle given my near total lack of mathematical ability. But hey, that’s what I’m there for. ^_^

                                    1. 2

                                      Working through more of the, thus far, excellent Machine Learning course on Coursera. The moon shot is to be playing with things that learn how to play games. :D It’s so NEAT.

                                      1. 1

                                        Looks good! I really like zippers on lists, but still haven’t internalised them for nested datastructures :(

                                        I’m currently writing JSON-to-JSON commands which need to avoid holding whole objects/arrays in memory (basically “mapping” over a few levels of nested objects, e.g. summing the array in {"x1":{"x2":[1,2,3]}} to get {"x1":{"x2":6}}). I’m currently doing this in a hacky way by manually reading one Char at a time from stdin, rather than using aeson’s parser. Do you think Waargonaut might be suitable for such streaming usage? (Note that one consequence of this requirement is that invalid input can cause parse errors after some output has already been given)

                                        1. 2

                                          There is work being done on the hw-json package that would enable streaming but it’s still early days. I don’t support “write” using the succinct data structure yet, only “read”. Although it is something I am working on.

                                          Until I have that or streaming working I would suggest having a look at lens-aeson, that would let you have a ByteString -> ByteString function but you can lens down into the JSON and change values, without having to decode the entire thing into memory.

                                          For your example, you would end up with something like:

                                          inputByteString & key "x1" . key "x2" . _Array %~ sum

                                          Doing that from memory so take it with a sack of salt.

                                          Waargonaut will have this functionality too, just at the moment aeson has me beat by 113 contributors and ~7 years of effort. :D

                                          1. 1

                                            Ah, I didn’t know lens-aeson (or GHC) was smart enough to fuse producers and consumers like that. I’ll give it a go; if it works it’ll be much nicer than my current pile of IO () actions (actually m () where m is IO in main and State in tests).

                                            1. 3

                                              My tenuous understanding is that there has been an immense amount of work put in to make the ByteString operations fuse and be fast. Commensurately the majority of lens functionality boils down to lambdas and fmap which GHC is very very good at optimising. So the two sort of collide and then we have nice victories like that. :)

                                        1. 5
                                          • $WORK
                                            • Working on using succinct data structures for a new Haskell JSON lib. The parser preserves all sorts of nice properties, like parse . print = id, so there is no loss of information. Yes, another JSON lib, but Aeson is a bit long in the tooth and there are design decisions I disagree with. Also succinct data structures are soooo much fun, and so sodding fast, omg.
                                            • More visualisation research with a goal to lay the groundwork for some sweet graphics and visualisation packages.
                                          • $ME
                                            • Peering into the abyss that is the world of machine learning, for funsies
                                            • Keep on reading, keep on reading, keep on reading.
                                            • Lift something, heavy.
                                          1. 4

                                            Working on my ‘Generative Art’ presentation using Haskell in the browser. Using the Reflex FRP package, amongst others, to make SVG, HTML5 Canvas, and WebGL dance at my bidding.

                                            Won’t have time to wire in the audio inputs before the talk though, which is a bit disappointing.

                                            1. 1

                                              That genuinely sounds interesting. The only experience I have with Generative Art is using p5.js after binge watching days worth of Dan Shiffmans coding train.

                                              1. 2

                                                I’ll post a link to the talk and code when it’s up. Otherwise I’m certainly happy to natter about it and related topics. I’m usually lurking in freenode in #qfpl, #reflex-frp, or #haskell-au :)