Hierarchical Clustering in Haskell