I have a set of possible colors defined like this:

```
data Peg = Red | Green | Blue | Yellow | Orange | Purple
deriving (Show, Eq, Ord)
colors = [Red, Green, Blue, Yellow, Orange, Purple]
```

And code which is a combination of colors defined like this:

```
type Code = [Peg]
```

I want to be able to generate the list of all possible combinations of length `len`

that can be made from the defined colors.

This is my original idea. I'm still learning so I'm not even sure if I have made some syntactic errors or constructs that are not supported.

```
allCodes :: Int -> [Code]
allCodes len = map (\p -> Code p) (permutations len)
where
permutations::Int->[Peg]
permutations 0 = [[]]
permutations n = [x:xs | x <- colors, xs <- permutations (n - 1)]
```

This doesn't compile, I'm getting the error:

```
[1 of 1] Compiling HW02 ( HW02.hs, interpreted )
HW02.hs:59:27: Not in scope: data constructor `Code'
Failed, modules loaded: none.
```

`Code`

works in other places where I used it so I'm not sure what's going on here. I know there are functions like `replicateM`

that can solve this quite easily, but I'd like to use only what comes in `Prelude`

.