Given the following definition of Cons:data Cons a = Cons a (Cons a)              | Empty              deriving ShowI implemented a flatten function.It's mean to work exactly like concat :: [[a]] -> [a], but for Cons.flatten :: Cons (Cons a) -> Cons aflatten Empty                = Emptyflatten (Cons (Empty) ys)    = flatten ysflatten (Cons (Cons x xs) ys) = Cons x (flatten (Cons xs ys))Test data:test1 :: Cons (Cons Int)test1 = Cons (Cons 5 Empty) Emptytest2 :: Cons (Cons Int)test2 = Cons (Cons 5 (Cons 10 Empty)) Emptytest3 :: Cons (Cons Int)test3 = Cons (Cons 5 (Cons 10 (Cons 20 Empty))) test2Some tests:ghci> flatten test1Cons 5 Emptyghci> flatten test2Cons 5 (Cons 10 Empty)ghci> flatten test3Cons 5 (Cons 10 (Cons 20 (Cons 5 (Cons 10 Empty))))
Implement `flatten` for `Cons`
haskell