Ambiguous occurrence `take'
It could refer to
either `Prelude.take',
imported from `Prelude' at src\Main.hs:1:8-11
(and originally defined in `GHC.List')
or `Data.Set.take',
imported from `Data.Set' at src\Main.hs:4:1-15
(and originally defined in `Data.Set.Internal')
or `Data.Map.take',
imported from `Data.Map' at src\Main.hs:3:1-15
(and originally defined in `Data.Map.Internal')
|
36 | createMines g fst = Data.Set.fromList $ take mineCount $ shuffle g $
Please tell me how to fix this error.I use import Data.Map and import Data.Set
The reason you get this error is because you imported modules that export functions with the same name. If you then use such function (like take
), the compiler does not know what function you aim to use.
You can make a qualified importĀ [Haskell-wiki], so:
import qualified Data.Set as S
You can then use a function the Data.Set
module with S.take
for example. If you use take
, it will use the one defined in the prelude.