Haskell Study Group

haskell
fp

#1

For all cohorts of the Haskell Study Group https://www.meetup.com/Vancouver-Functional-Programmers.

http://workshops.vanfp.org/haskell/

NOTE
We’re trying out YVRDev community and a subredidt at https://reddit.com/r/yvrhffp. We’ll see which has more adoption, and use that one.


#2

Just messing around with some of the chapter exercises, I got an interesting result with concat that I don’t quite understand:

-- the example in the book, we're taking a two lists wrapped in
-- a list and flattening them into one
> concat [[1,2,3], [4,5,6]]
[1,2,3,4,5,6] 

-- I figured that wrapping the two lists in parens would blow up,
-- but it gave me this! Curious...
> concat ([1,2,3], [4,5,6])
[4,5,6]

#3

hehe indeed! We’ll find out why when we get to type classes :wink: [Spoiler: class instances for tuples — parens with commas, like (1, 2) — can be somewhat counterintuitive]

Also, to clear up some syntax: the form foo (a, b) doesn’t call foo with arguments a and b, as you’d expect coming from other languages. (a, b) is a tuple, and the tuple is passed as an argument to foo


#4

Got it, thanks for the explanation! Looking forward to type classes.