Let&#39;s first discuss what a tuple is.<br>Here[1] it says, &quot;A tuple is a fixed-size collection of values,
      where each value can have a different type.&quot;<br><br>So they are of fixed-size and they can have values of different types. I am guessing the reason you want to use a tuple os that you want your collection object to be able to handle different types. But what about the fixed size bit?<br>
<br>If you want to just have those values in a collection, the easiest thing you can do is putting them into a list. The problem with lists is that the elements in them need to be of same type. If you just want every word, as a string, it is easy. If you want to have _either strings or ints_ within the list, then you need to define a data type which holds either strings or ints, and have a list of this type.<br>
<br>Just an example,<br><br><div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">import Data.Char(isDigit)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">testString = &quot;hello world 13 i am a new 37 developer 82&quot;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">data StringOrInt = S String | I Int</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    deriving (Eq,Ord,Show)</span><br style="font-family: courier new,monospace;"><br><span style="font-family: courier new,monospace;">readInt :: String -&gt; Int</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">readInt = read<br><br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">toStringOrInt :: String -&gt; StringOrInt</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">toStringOrInt x</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    | all isDigit x = I (readInt x)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    | otherwise     = S x</span><br style="font-family: courier new,monospace;"><br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">test = map toStringOrInt (words testString)</span><br style="font-family: courier new,monospace;">

<br>
<span style="font-family: courier new,monospace;">-- Output: [S &quot;hello&quot;,S &quot;world&quot;,I 13,S &quot;i&quot;,S &quot;am&quot;,S &quot;a&quot;,S &quot;new&quot;,I 37,S &quot;developer&quot;,I 82]</span><br style="font-family: courier new,monospace;">

<br></div><br><br>Note: I changed the separator from commas to spaces, for the sake of easiness and understandablity. Hope this helps in some way.<br><br><br>[1] <a href="http://book.realworldhaskell.org/read/types-and-functions.html">http://book.realworldhaskell.org/read/types-and-functions.html</a><br>
<br><div class="gmail_quote">On 5 March 2010 15:52, Pradeep Wickramanayake <span dir="ltr">&lt;<a href="mailto:pradeep@talk.lk">pradeep@talk.lk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">











<div link="blue" vlink="purple" lang="EN-US">

<div>

<p class="MsoNormal">As luke requested</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Here is the codes and some more brief explanation. Please help
me</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"> getItemFile :: IO String</p>

<p class="MsoNormal"> getItemFile  = </p>

<p class="MsoNormal">                                 do</p>

<p class="MsoNormal">                                                 test &lt;-
readFile &quot;input.txt&quot;</p>

<p class="MsoNormal">                                                 return test</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">im taking a file data to a string </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">it contains string like “hello,world,I,am,a,new,developer”</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">so I need to put these each to a tuple. Because the content
have Integers and Strings</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">sortList2 :: String -&gt; String</p>

<p class="MsoNormal">sortList2 (x:xs) </p>

<p class="MsoNormal">                | x == &#39;,&#39; = &quot;&quot;</p>

<p class="MsoNormal">                | otherwise = [x] ++ sortList2 xs</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Im breaking word by word from this above function</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Now I need to send it to a tuple. Can someone help me how to
do it. Is this possible. Using recursion im checking each word till “,”
occurs</p>

<p class="MsoNormal">And taking that string and passing it to the tuple. </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Can someone please help me to do it. </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Please </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"> </p>

<p class="MsoNormal"> </p>

</div>

 <br><br>__________ Information from ESET NOD32 Antivirus, version of virus signature database 4918 (20100305) __________<br><br>The message was checked by ESET NOD32 Antivirus.<br><br><a href="http://www.eset.com" target="_blank">http://www.eset.com</a><br>
 </div>


<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Ozgur Akgun<br>