Reputation: 3475
how to write a function from list to a tuple
i have taken the string to a tuple. but i need to send it to a tuple.
can someone help me
Upvotes: 2
Views: 299
Reputation: 523214
You can't convert an arbitrarily long list to a tuple because tuples of different lengths are considered as distinct types. But you can have:
listToTuple2 :: [a] -> (a, a)
listToTuple3 :: [a] -> (a, a, a)
listToTuple4 :: [a] -> (a, a, a, a)
listToTuple5 :: [a] -> (a, a, a, a, a)
etc.
Upvotes: 3