Thank you so much Ivan!!!
On 4 November 2011 16:21, yrazes <yrazes@gmail.com> wrote:First of all, it would help if you said what your actual trouble is.
> Hi
> This is a very simple basic case, but I have a little trouble with this... I
> hope somebody can help me
The "return :: f" bit here doesn't make any sense:
> main :: IO()
> main = return :: f
* :: is used in type signatures, not as an operator in code; you
shouldn't need it (assuming your definition of f below is meant to be
there).
Your definition of tipos isn't complete... what you've actually
> tipos :: Int -> Int -> Int -> Float
> tipos a b c
> f = b / a * c
> where
> (a,b,c) = (8,3,15)
defined is a new top-level value `f' (which is of type Fractional a =>
a). You need to actually have "tipos a b c" _equal_ something.
Now, if you want to calculate "b/a*c" for inputs a, b and c, try
something like this:
import System.Environment(getArgs)
main :: IO ()
main = do [a,b,c] <- getArgs
print $ tipos (read a) (read b) (read c)
tipos :: Int -> Int -> Int -> Double
tipos a b c = fromIntegral b / fromIntegral b * fromIntegral c
--
Ivan Lazar Miljenovic
Ivan.Miljenovic@gmail.com
IvanMiljenovic.wordpress.com