Q:

Haskell - List of Characters recursion

I am currently doing an assignment in Haskell, which i need some help with.
The basic function is to find the number of vowels in a string.
This is my code so far: 
import Data.List
import Data.Tuple

vowels :: [Char]
vowels = "aeiou"    --List of vowel characters

getLetterCount :: Char -> String -> Int
getLetterCount c s = length (filter (\x -> x == c) s)

getLetterTuple :: Char -> String -> (Char, Int)
getLetterTuple c s = (c, (getLetterCount c s))

getVowelCount :: String -> [(Char, Int)]
getVowelCount s = [ getLetterTuple (head vowels) s ]

main = do
 putStrLn $ show $ getVowelCount "many vowels in this sentence"

The which gives this output:
[('a',1)]

However, the output needs to be this:
[('a',1),('e',4),('i',2),('o',1),('u',0)]

I can't seem to loop through each item in the 
vowels :: [Char]
vowels = "aeiou"

list.
Does anyone know how I might do this??
Any help would be really appreciated, Thanks

A:

I'll try to expand upon the answer I already gave in the comments, since I was asked to explain a little more:
getVowelCount s = map (flip getLetterTuple s) vowels

First, let's look at the definition of flip (http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Base.html#flip):
flip                    :: (a -> b -> c) -> b -> a -> c
flip f x y              =  f y x

As its name suggests, this flips the arguments of a function of 2 arguments. (More generally, because of currying, it flips the first 2 arguments of any function which takes 2 or more.) So, where getLetterTuple has type Char -> String -> (Char, Int),  flip getLetterTuple has type String -> Char -> (Char, Int). The order is important because this can be rewritten as String -> (Char -> (Char, Int)). This means that, given a string (your s here), flip getLetterTuple gives a function from a Char to a pair (Char, Int).
So flip getLetterTuple s (which we get from "partially applying" flip getLetterTuple) is a function which, given a character, yields a pair consisting of that letter and the number of times it occurs in s. Now if we map that over vowels - which is just a list of characters ("aeiou" is syntactic sugar for the list ['a', 'e', 'i', 'o', 'u']), we get the result you want. [If you're not too familiar with map, it takes a function and a list and applies the function to every element of the list, resulting in a new list.]
I hope this explains what is going on, although you might have to reread some of it a few times to understand. Feel free to ask if you have any further questions.

