我无法理解为什么以下代码会导致错误.如果第二个字段Foo更改为type Int,则代码运行时没有错误.
Prelude> data Foo = Foo {foo_a :: Int, foo_b :: Float}
Prelude> let x = Foo 2 3.4
Prelude> unwords $ map (\fn -> (show . fn) x) [foo_a, foo_b]
<interactive>:4:46:
Couldn't match type `Float' with `Int'
Expected type: Foo -> Int
Actual type: Foo -> Float
In the expression: foo_b
In the second argument of `map', namely `[foo_a, foo_b]'
In the second argument of `($)', namely
`map (\ fn -> (show . fn) x) …Run Code Online (Sandbox Code Playgroud) 我正在尝试从flask/gunicorn服务器传输数据:
while (True):
result = json.dumps(tweetQueue.get())
yield result
Run Code Online (Sandbox Code Playgroud)
然而,在流中30秒后,gunicorn超时我的连接并停止流.如何进行超时,以便从服务器向流中发布新数据将重新启动超时,以便流不会被终止?
谢谢!