Tag Archives: Haskell

Fiddling with Functors

Learn you a Haskell continues to bend my mind. This week we were looking at the first half of the chapter on Functors, Applicative Functors and Monoids. I feel I’m following along with the text okay, but just getting brief glimpses at the strange beasts that that lay beneath. While noodling around with one of the examples

ghci> (:) <$> Just 3 <*> Just [4]  
Just [3,4]

I wondered if the type system could infer one of those Justs. Continue reading Fiddling with Functors

Point-free baby-steps in Haskell

we7‘s study group (still aka Nerd Club) has moved onto a bit of Haskell with Learn You a Haskell for Great Good. The chapter on higher order functions introduces this definition:

numLongChains :: Int
numLongChains = length (filter isLong (map chain [1..100]))
    where isLong xs = length xs > 15

For some reason I immediately wanted to factor the thing as a function taking isLong as a parameter: Continue reading Point-free baby-steps in Haskell