<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dumb! I've been hacking Lisp and just slipped over to Haskell to check on something.<br><br>Thanks,<br><br>Michael<br><br>--- On <b>Sat, 1/16/10, VoidPrayer <i><voidprayer@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: VoidPrayer <voidprayer@gmail.com><br>Subject: Re: [Haskell-cafe] What's going on here?<br>To: haskell-cafe@haskell.org<br>Date: Saturday, January 16, 2010, 10:05 PM<br><br><div class="plainMail">在 2010年 1月 17日 星期日 11:02:59,michael rice 寫道:<br>> I don't see anything wrong with this function, which just subtracts 1 from<br>> the first element of an Int list (if there is a first element).<br>> <br>> Michael<br>> <br>> My function:<br>> <br>> dropFirst :: [Int] -> [Int]<br>> dropFirst [] =
[]<br>> dropFirst (x:xs) = (x-1) : xs<br>> <br>> My output:<br>> > :l dropfirst<br>> <br>> [1 of 1] Compiling Main ( dropfirst.hs, interpreted )<br>> Ok, modules loaded: Main.<br>> *Main> dropFirst [3 4 5 6]<br><br>Use dropFirst [3,4,5,6], I think.<br><br>> <br>> <interactive>:1:11:<br>> No instance for (Num (t -> t1 -> t2 -> Int))<br>> arising from the literal `3' at <interactive>:1:11-17<br>> Possible fix:<br>> add an instance declaration for (Num (t -> t1 -> t2 -> Int))<br>> In the expression: 3 4 5 6<br>> In the first argument of `dropFirst', namely `[3 4 5 6]'<br>> In the expression: dropFirst [3 4 5 6]<br>> *Main><br>>
<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=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></div></blockquote></td></tr></table><br>