Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Hidden Packages: Data.HashSet

I'd like to use Data.HashSet in Haskell. So I put import Data.HashSet at the beginning of my program. GHCi complains: Could not find module Data.HashSet.

My questions are:

  • How can I get Data.HashSet to work?
  • I've read somewhere that this is part of a hidden module or package. Why is the module hidden? Does "hidden" mean that I should not use it?
  • If I should not use it, is there a better alternative for a haskell data structure with a near-constant lookup time?
like image 604
Hinton Avatar asked Sep 02 '25 16:09

Hinton


1 Answers

Data.HashSet is a module in the unordered-containers package, and also in the hashmap package. If you have either package installed,

import Data.HashSet

should work out of the box, since it is an exposed module of both packages. To install it (using unordered-containers, since that is the commonly used one),

cabal update
cabal install unordered-containers --dry-run
-- check that it wouldn't reinstall anything, if all's fine
cabal install unordered-containers
like image 197
Daniel Fischer Avatar answered Sep 05 '25 20:09

Daniel Fischer