简体   繁体   中英

Question about a Haskell function with tuples

how can help me getting this main function running, dont know how to do this, i made a small example:

tuple :: String -> (Bool, String)
tuple x = (True, x)

getStr :: String
getStr = "test"

main = do
    putStrLn snd (tuple getStr)
    putStrLn "End"

You're missing parenthesis around the application of snd :

main = do
    putStrLn (snd (tuple getStr))
    putStrLn "End"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM