I am getting this error when I compile:
Ambigous occurence 'map'
It could refer to either Main.map defined at blablabla
I read a similar post here and tried this :
import qualified Data.Map as Map
map :: (a->b) -> [a] -> [b]
map f [] = []
map f (x:xs) = f x : map f xs
I am still getting the error. I am compiling on GHCI.
How can I avoid this ?
import Prelude hiding(map)Preludeis the module which gets imported into every Haskell file implicitly. It also declares amapfunction and this is triggering the error. By adding the line, you're importingPreludebut hiding themapfunction in it, thus avoiding the conflictmap' :: (a->b) -> [a] -> [b].