This is my code:
type HoraAtendimento = (String, Int, Int) htmlHAtendimento :: [HoraAtendimento] -> Html htmlHAtendimento [] = toHtml '' htmlHAtendimento ((da,hia,hfa):[]) = toHtml da +++ 'feira ' +++ show hia +++ 'h - ' +++ show hfa +++ 'h' htmlHAtendimento ((da,hia,hfa):r) = toHtml da +++ 'feira ' +++ show hia +++ 'h - ' +++ show hfa +++ 'h, ' +++ htmlHAtendimento r
I’m looking for a way to use the map function and get rid of this recursive function. Is that possible and if so, how do I do it?
Look at the type of
map. It is(a -> b) -> [a] -> [b]. That doesn’t look like your type, which is [a] -> b. That’s not a map, that’s a fold.The higher-order function you want to look at is
foldr. See Hoogle.Something like…
I don’t know if that’s correct, but that’s in the right direction.