I have the following function which should adds up all numbers in a given list up to the current position. For example, `subtotal [1, 2, 3, 4] = [1, 3, 6, 10]`, because 1 = 1, 1 + 2 = 3, 1 + 2 + 3 = 6 and 1 + 2 + 3 + 4 = 10.

Here's my code:

```
subtotal :: Num a => [a] -> [a]
subtotal [] = []
subtotal xs = [y | n <- [1..length xs], y <- sum(take n xs)]

```

The problem is Im getting this error:

```
cw.hs:3:46: error:
    * Couldn't match expected type `[a]' with actual type `a'
      `a' is a rigid type variable bound by
        the type signature for:
          subtotal :: forall a. Num a => [a] -> [a]
        at cw.hs:1:1-31
    * In the expression: sum (take n xs)
      In a stmt of a list comprehension: y <- sum (take n xs)
      In the expression:
        [y | n <- [1 .. length xs], y <- sum (take n xs)]
    * Relevant bindings include
        xs :: [a] (bound at cw.hs:3:10)
        subtotal :: [a] -> [a] (bound at cw.hs:2:1)
  |
3 | subtotal xs = [y | n <- [1..length xs], y <- sum(take n xs)]
  |                                              ^^

```

How can I fix it?