How to change the typing in Haskell

2

I want the function to draw a number, and if it is greater than 7, send an approval message and call this add function. However, my function only falls on the 'else'. The "disapproved" message appears. I think it's the IO Float typing with Float. How to solve?

sortear :: Float -> Int
sortear x = ceiling(10 * x)


numeroSorteado :: IO ()
numeroSorteado = do    
    num <- randomIO :: IO Float
    print $ sortear num
    if(num >= 7) then
        do
            putStrLn ("Aprovado!" ++ "\n") >> adicionar
        else
        do
            putStrLn "Reprovado!"

adicionar = do
    putStrLn "Nome:"
    nome <- getLine
    putStrLn "Sobrenome:"
    sobrenome <- getLine
    putStrLn "CPF:"
    cpf <- getLine
    putStrLn "Idade:"
    idade <- getLine
    putStrLn "Salario:"
    salario <- getLine
    putStrLn "Cargo (Estagiario, Analista, Gerente, Diretor, VicePresidente ou Presidente) :"
    cargo <- getLine
    let new =  (nome ++ " "++ sobrenome ++ " " ++ cpf ++ " " ++ idade ++ " " ++ salario ++ " " ++ cargo ++ "\n")
    appendFile "funcionarios.txt" new
    putStrLn "Funcionario Salvo!"
    
asked by anonymous 09.12.2017 / 07:55

1 answer

2

The problem in your code is due to the line that contains the following information:

  

num

09.12.2017 / 23:54