Haskell`do`中具有多个返回值的类型不匹配

Haskell`do`中具有多个返回值的类型不匹配,haskell,type-mismatch,do-notation,Haskell,Type Mismatch,Do Notation,我有下面的代码,但在编译时我遇到了几个错误。我可以从do语句中以元组形式返回两个变量吗 Couldn't match type ‘[]’ with ‘(,) String’ Expected type: (String, Char) Actual type: String • In a stmt of a 'do' block: f <- string_prog (g) Couldn't match expected type ‘(String, t0

我有下面的代码,但在编译时我遇到了几个错误。我可以从
do
语句中以元组形式返回两个变量吗

Couldn't match type ‘[]’ with ‘(,) String’
      Expected type: (String, Char)
        Actual type: String
    • In a stmt of a 'do' block: f <- string_prog (g)

Couldn't match expected type ‘(String, t0)’
                  with actual type ‘Int’
    • In a stmt of a 'do' block: tx <- mult_prog x y

Couldn't match expected type ‘t0 -> Int’ with actual type ‘Char’
    • The function ‘f’ is applied to one argument,
      but its type ‘Char’ has none
无法将类型“[]”与“(,)字符串”匹配
预期类型:(字符串,字符)
实际类型:字符串
•在“do”块的stmt中:实际类型为“Char”的f Int
•函数“f”应用于一个参数,
但是它的类型“Char”没有
mult\u prog::Int->Int->Int
mult_prog one1 one2=one1*one2
字符串程序::字符串->字符串
字符串_prog s=(“++s++”)
do_prog::String->Int->Int->(String,Int)
do_prog g x y=do f
Int->Int
mult_prog one1 one2=one1*one2
字符串程序::字符串->字符串
字符串_prog s=(“++s++”)
do_prog::String->Int->Int->(String,Int)
do_prog g x y=do let f=string_prog g
设tx=mult_prog x y
(德克萨斯州f区)
请注意,您甚至不需要
do
,只需使用
let…in

mult\u prog::Int->Int->Int
mult_prog one1 one2=one1*one2
字符串程序::字符串->字符串
字符串_prog s=(“++s++”)
do_prog::String->Int->Int->(String,Int)
do_prog g x y=设f=字符串
tx=多个程序x y
in(f,tx)

第一个代码片段以及它的工作原理和原因最好留给好奇心部门,而不是交给语言新手,他们肯定会被它弄糊涂。感谢您的澄清和关于Monads的说明,请参阅。
    mult_prog :: Int -> Int -> Int
    mult_prog one1 one2 = one1 * one2
                            
    string_prog :: String -> String
    string_prog s = ("  " ++ s ++ "   ")     
    
    
    do_prog :: String -> Int -> Int -> (String, Int)
    
    do_prog g x y =   do f <- string_prog(g)  
    
                         tx <- mult_prog x y
    
                         return $ f tx