i have encode function: class encode encode :: -> [bit] and have problems writing function encodes list of type a list of bits. want recursively encode elements of list. in understanding can use map function purpose. problem encode returns list [bit], whereas map expects bit. how can solve this? here relevant part of program. instance encode => encode [a] encode [] = [i, o, o, i, o, i] encode m = ([i, o, o] ++ (map encode m) ++ [i, o, i]) use concatmap . concat enates results after map ping them. instance encode => encode [a] encode [] = [i, o, o, i, o, i] encode m = ([i, o, o] ++ (concatmap encode m) ++ [i, o, i]) how have found out yourself: if search type of function want, (a -> [bit]) -> [a] -> [bit] , using hoogle , concatmap first result.