What is the type constructor which generates a concrete type like [(Int,String)]
?
I think this really sounds either like a stupid question or a meaningless riddle. I hope the following convinces you that I'm actually trying to find gaps in my understanding of the basics.
I know that []
to "visualize" the second aspect, I can just type
> x = [1,2,3] :: [] Int
> :t x
x :: [Int]
which clearly shows that []
applied to the concrete type Int
gives another concrete type [Int]
.
So far so good.
On the other hand, (,)
also has two meanings:
> x = (1,1) :: (,) Int Int
> :t
x :: (Int, Int)
> (,) 1 "hello"
(1,"hello")
So, if both []
and (,)
are type constructors that can originate, among other types, concrete types [Int]
and (Int,Char)
, I wonder what is the type constructor that generates a type like [(Int,Char)]
.
It's not so much a single type constructor as it is a nested type constructor:
λ> x = [(1, 'a')] :: [] ((,) Int Char)
λ> :t x
x :: [(Int, Char)]