Skip to content

Instantly share code, notes, and snippets.

@mamachanko
Created April 9, 2017 07:35
Show Gist options
  • Save mamachanko/1c3a38f3707fb4e6540f2ad1ecf45638 to your computer and use it in GitHub Desktop.
Save mamachanko/1c3a38f3707fb4e6540f2ad1ecf45638 to your computer and use it in GitHub Desktop.
module This exposing (..)
import Date
import Dict
type alias Entry =
{ date : Date.Date
, text : String
}
groupByDate : List Entry -> List ( Date.Date, List Entry )
groupByDate entries =
groupByDate_ entries Dict.empty
-- groupByDate_ : List Entry -> Dict.Dict Date.Date List Entry -> List ( Date.Date, List Entry )
-- ^ does not compile
-- groupByDate_ : List Entry -> Dict.Dict comparable v -> List ( Date.Date, List Entry )
-- ^ does not compile either
groupByDate_ entries result =
Dict.toList result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment