I am trying to use the incremental update operator for an array. I keep
getting this error message on the nhc98 compiler:
====================================
Error after type deriving/checking:
Type error type clash between Prelude.2 and Prelude.[]
when trying to apply function at 24:31 to its 2:nd argument at 24:34.
====================================
It is at my insertEntry function at the bottom. I have tried everything
that I can think of. From what I see I am doing it like the documentation
tells me. Can any one help? Here is my code:
************************************
module Main(main) where
import Array
type Entry = (String, String)
type HashTable = Array Int Entry
createHashTable :: HashTable
createHashTable = array (1,100) [(i,("","")) | i <- [1..100]]
hashFunc :: String -> Int
hashFunc key = hashFunc key
outputEntry :: HashTable -> String -> IO ()
outputEntry table key = putStrLn(getSecond (table!(hashFunc key)))
getFirst :: (String,String) -> String
getFirst (x,y) = x
getSecond :: (String,String) -> String
getSecond (x,y) = y
insertEntry :: HashTable -> Entry -> HashTable
insertEntry table ent = table // [(1,"Hello")]
main = putStrLn "Done."