Como resolver problemas ao obter erros:Fora do escopo
-
13-12-2019 - |
Pergunta
*Main> :t putStrn <interactive>:1:1: Not in scope: `putStrn' Perhaps you meant one of these: `putStr' (imported from Prelude), `putStrLn' (imported from Prelude)
Observe que estou praticando programação haskell no emacs com modo haskell.
Mesmo ao usar o terminal, estou recebendo o seguinte erro:
optimight@optimight:~$ ghci GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :set prompt ghci> ghci>:t putStrln <interactive>:1:1: Not in scope: `putStrln' Perhaps you meant one of these: `putStrLn' (imported from Prelude), `putStr' (imported from Prelude)
Solução
A ação de E/S que você está procurando é putStrLn
.Observe o L maiúsculo — os símbolos Haskell diferenciam maiúsculas de minúsculas — logo antes do n final, como em “coloque uma string em um linha próprio.”.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow