The type signature you provided for typeOfMove doesn&#39;t match the function body.<br>&quot;typeOfMove :: (a,b) -&gt; [Int]&quot; says that typeOfMove takes a tuple of two different values, and returns a list of Ints, but the definition you provided for typeOfMove only takes a list. I think perhaps what you want is something more like:<br>
<br>import Data.Char (toLower)<br>import Control.Monad (liftM)<br><br>typeOfMove :: (Char, Int) -&gt; [Int] -&gt; [Int]<br>typeOfMove (&#39;a&#39;, x) xs = zipWith (-) xs [x,0,0]<br>typeOfMove (&#39;b&#39;, x) xs = zipWith (-) xs [0,x,0]<br>
typeOfMove (&#39;c&#39;, x) xs = zipWith (-) xs [0,0,x]<br><br>main :: IO ()<br>main = do<br>    putStrLn &quot;Which pile (A,B,C)?&quot;<br>    x &lt;- liftM toLower $ getChar<br>    putStrLn &quot;&quot;<br>    putStrLn &quot;How many stones?&quot;<br>
    y &lt;- readLn<br>    let z = typeOfMove (x,y) [5,6,7]<br>    putStrLn . show $ z<br><br>Of course, another way to do much the same thing is the following, which has the advantage that you don&#39;t get an exception inside the typeOfMove function if the user passes in a value besides A, B, or C, although you do get an exception when readLn attempts to perarse the value (which is better because you can trap the exception there and re-ask for the correct value). Similarly this version still isn&#39;t very good because it doesn&#39;t do any sort of bounds checking on the number of stones to subtract, but I leave that as an exercise to you.<br>
<br>data PileName = A | B | C deriving (Show, Eq, Read)<br><br>
typeOfMove :: (PileName, Int) -&gt; [Int] -&gt; [Int]<br>
typeOfMove (A, x) xs = zipWith (-) xs [x,0,0]<br>
typeOfMove (B, x) xs = zipWith (-) xs [0,x,0]<br>
typeOfMove (C, x) xs = zipWith (-) xs [0,0,x]<br><br>main :: IO ()<br>
main = do<br>
    putStrLn &quot;Which pile A, B, or C (case matters)?&quot;<br>
    x &lt;- readLn<br>
    putStrLn &quot;How many stones?&quot;<br>
    y &lt;- readLn<br>
    let z = typeOfMove (x,y) [5,6,7]<br>
    putStrLn . show $ z<br>
<br><br>-R. Kyle Murphy<br>--<br>Curiosity was framed, Ignorance killed the cat.<br>
<br><br><div class="gmail_quote">On Mon, Oct 26, 2009 at 07:51, John Moore <span dir="ltr">&lt;<a href="mailto:john.moore54@gmail.com">john.moore54@gmail.com</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>Hi All,</div>
<div>          In the game of nim I want to make a move such as take x from pile A. This will then be subtracted from the starting list.Is this correct in as much as I want to have a move Take 3 from pile  A: input would be A3 I need it to return a list as I wish to take this result and use zipwith (-) [starting list][result]. How do I use the result, do I store in a variable?</div>


<div> </div>
<div>typeOfMove :: (a,b) -&gt; [Int]<br>typeOfMove ax<br>  |ax = [x,0,0]<br>  |bx = [0,x,0]<br>  |cx = [0,0,x]</div>
<div>  </div><font color="#888888">
<div>John        </div>
</font><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br>