For an assignment, the following codes was given
-- 2. Index
class Index i where
findEntry :: Eq k => k -> i k -> Maybe Entry
empty :: Eq k => i k
singleton :: Eq k => k -> Entry -> i k
(<+>) :: Eq k => i k -> i k -> i k
-- a. Complete the definition of Assoc
data Assoc k
= MkAssoc [(k,Entry)]
deriving (Eq,Show)
-- b. Complete the instance of Index for Assoc
instance Index Assoc where
I'm now completely stuck at question 2.b. How do I make the empty and findEntry and the other things? Where does the 'k' come from in index? How come the output of some functions is (i k)? That't not even a type.
kis thektypeparameter that binds withAssoc, sokis the "key" type.