Created
April 4, 2020 21:45
-
-
Save randomshinichi/6bcc08a077b4758dad98d81ae010c3fb to your computer and use it in GitHub Desktop.
problematic Haskell code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inputToNum :: String -> Num | |
inputToNum msg = do | |
putStr msg | |
i <- getLine | |
let o = read i :: Int | |
return o | |
nameDo :: IO () | |
nameDo = do | |
base <- inputToNum "The base? " | |
height <- inputToNum "The height? " | |
let area = base * height | |
putStrLn ("The area of that triangle is " ++ show area ) | |
shinichi@asuka:~/source/hangman ghc hello.hs | |
[1 of 1] Compiling Main ( hello.hs, hello.o ) | |
hello.hs:1:25: error: | |
• Expecting one more argument to ‘Num’ | |
Expected a type, but ‘Num’ has kind ‘* -> Constraint’ | |
• In the type signature: inputToNum :: String -> Num | |
| | |
1 | inputToNum :: String -> Num | |
| ^^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment