Thank you so much Ivan!!!<div><br></div><div><div>main :: IO ( )</div><div>main =</div><div> let</div><div> a = 8</div><div> b = 3</div><div> c = 15</div><div> in print(b / a * c)</div><div><br>
</div><div><br></div><div><br></div><div>This code works!!! :)</div><div>Julita</div><br><div class="gmail_quote">On Fri, Nov 4, 2011 at 12:53 AM, Ivan Lazar Miljenovic <span dir="ltr"><<a href="mailto:ivan.miljenovic@gmail.com">ivan.miljenovic@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 4 November 2011 16:21, yrazes <<a href="mailto:yrazes@gmail.com">yrazes@gmail.com</a>> wrote:<br>
> Hi<br>
> This is a very simple basic case, but I have a little trouble with this... I<br>
> hope somebody can help me<br>
<br>
</div>First of all, it would help if you said what your actual trouble is.<br>
<div class="im"><br>
> main :: IO()<br>
> main = return :: f<br>
<br>
</div>The "return :: f" bit here doesn't make any sense:<br>
<br>
* :: is used in type signatures, not as an operator in code; you<br>
shouldn't need it (assuming your definition of f below is meant to be<br>
there).<br>
<div class="im"><br>
> tipos :: Int -> Int -> Int -> Float<br>
> tipos a b c<br>
> f = b / a * c<br>
> where<br>
> (a,b,c) = (8,3,15)<br>
<br>
</div>Your definition of tipos isn't complete... what you've actually<br>
defined is a new top-level value `f' (which is of type Fractional a =><br>
a). You need to actually have "tipos a b c" _equal_ something.<br>
<br>
Now, if you want to calculate "b/a*c" for inputs a, b and c, try<br>
something like this:<br>
<br>
import System.Environment(getArgs)<br>
<br>
main :: IO ()<br>
main = do [a,b,c] <- getArgs<br>
print $ tipos (read a) (read b) (read c)<br>
<br>
tipos :: Int -> Int -> Int -> Double<br>
tipos a b c = fromIntegral b / fromIntegral b * fromIntegral c<br>
<font color="#888888"><br>
--<br>
Ivan Lazar Miljenovic<br>
<a href="mailto:Ivan.Miljenovic@gmail.com">Ivan.Miljenovic@gmail.com</a><br>
<a href="http://IvanMiljenovic.wordpress.com" target="_blank">IvanMiljenovic.wordpress.com</a><br>
</font></blockquote></div><br></div>