- http://pragprog.com/magazines/2012-08/thinking-functionally-with-haskell
- http://pragprog.com/magazines/2012-09/thinking-functionally-with-haskell
- http://pragprog.com/magazines/2012-10/thinking-functionally-with-haskell
- http://pragprog.com/magazines/2012-11/thinking-functionally-with-haskell
- http://pragprog.com/magazines/2012-12/web-programming-in-haskell
- http://pragprog.com/magazines/2013-01/web-programming-in-haskell-part-ii
- http://pragprog.com/magazines/2013-03/uncle-bob-and-functional-programming
- http://pragprog.com/magazines/2013-04/dependent-types
- http://pragprog.com/magazines/2013-05/dependent-types-part-ii
- http://pragprog.com/magazines/2013-06/unification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- compiles with ghc(i) 7.4.1 | |
import Data.Map (Map, empty, insertWith, toList) | |
import Data.List(groupBy, group, sortBy, sort) | |
{- To recap from the main article, we want to define "group_on" via "groupBy", so that its | |
type is something like (b -> b -> Bool) -> (a -> b) -> [a] -> [(b, [a])] | |
The method here is to work with a concrete example and gradually massage it | |
into the form we want - using the REPL |