I am wondering whether my definition of a list is less capable than the regular implementation. I am having problems creating a list of lists with the below definition:
data List a =
Nil
| Cons a (List a)
deriving (Eq, Ord, Show)
I do not see how to create a list like [[2],[3]] with my definition of list.
The simplest instance of a nested list is just [[]] which I think I can recreate with Cons Nil Nil. The second simplest instance of a nested list is [[1]]. This is Cons (Cons 1 Nil) Nil afaics.
However, like I said do not see how to create the list [[2],[3]] with my definition above. How do I do it? (It should be possible, since an exercise asks me to create a monad instance for the list definition above).