Hoodlums Meetup

• Apr 11, 2013 · 6:30 PM
• This location is shown only to members

Hoodlums meetups follow a "Coding Dojo" style - we pick an interesting problem and solve it as a group. Bring a laptop. We have WiFi and a projector... and when we're done hacking, we grab a beer or a bite.

Although this year's meetups are still monthly, most of them are not on the second Thursday of the month as rooms aren't available. Please check the individual dates.

• Andres L.

I suggested the following exercise during the meeting if you want to try a toy example in a similar style to the type-driven row handler we wrote:

Define a function "cat" that takes an arbitrary number of strings and returns the concatenation of all strings. You'll need the FlexibleInstances extension (but should not need any others). When calling in GHCi, you will have to annotate the result type of the function. Examples:

> cat :: String
""
> cat "foo" "bar" :: String
"foobar"
> cat "Haskell" "Hoodlums" "Meetup" :: String

If you like a follow-up exercise, then modify the function into a function count that takes an arbitrary number of String or Integer arguments and computes an Integer that is the sum of all the given integers plus the sum of the lengths of all strings. Examples:

> count :: Integer
0 > count "foo" (7 :: Integer) "bar" :: Integer
13

You can also try to get rid of the Integer type annotation on the argument.

April 12, 2013

• Andres L.

Paul's solution is exactly what I had in mind. Yes, placing the final method within the class is also possible, but I cannot see any real advantage, given that a uniform definition is available.

April 17, 2013

• Tim W.

This is a great exercise. Last night I came up with a solution with one typeclass and three instances for count. But otherwise it was similar to Paul's solution.

April 17, 2013

• Peter M.

April 13, 2013

• Dr. Ian K.

Is the code available somewhere?

April 12, 2013

• Sangeetha B

Thank you for the session Peter. It's interesting how the code evolved, started of with a simple SQL query, recursion logic and finally the common/potentially unsafe behaviour is extracted out and made into a typeclass. Thanks to Andres for suggesting the motivation for writing such typeclasses with the quickcheck analogy.

April 12, 2013

• Christian J.

Hm, I'm too late to respond to the RSVP. I wonder whether I should just turn up anyway? (Why is it closed almost 24 hours before the event?)

April 11, 2013

• Peter M.

I need to give names to the security desk. I'll add you now if you can still make it

April 11, 2013

• Eda M.

The trains are conspiring against me. Sorry, have to cancel.

April 11, 2013

• Ben F.

Sorry for the late notice, but I can't make tonight.

April 11, 2013

• Rustem S.

busy at work

April 11, 2013

• Hok Shun P.

Plans have changed.

April 10, 2013

• Oliver C.

Sadly can't make this one as work servers are on fire and I need to be around in the evening for emegency maintainence. Have a good un!

April 10, 2013

• Rachel D.

Sorry will be in Bristol for ACCU conference then

March 17, 2013

15 went

• Lorenz
• A former member
• A former member
• A former member

London, United Kingdom

Founded Jul 21, 2010

People in this Meetup are also in:

• OpenSource & Agile Community Events

4,455 OpenSource and Agile developers

• London Software Craftsmanship Community

3,847 Software Crafters

• HNLondon

8,067 Hackers

• LJC - London Java Community

5,950 Java Developers

• London HalfStack

1,579 Software Engineers