小编Bri*_*ore的帖子

Amazon S3 静态网站托管和 REST API 访问?

我目前正在使用 S3 存储桶的 rest api 来访问我公司应用程序的图像。我编写了 lambda 函数来帮助减轻我的应用程序的负载,但为了利用这些函数,我必须更改 S3 存储桶中的设置以充当静态网站主机。当我这样做时,我可以再访问原始的 rest api。我想同时利用 REST api 和静态网站 url 来使从一个到另一个的过渡顺利,但我找不到关于这样做的任何细节。甚至有可能吗?

REST API 请求示例 https://s3.amazonaws.com/bucketname.mycompany.com/spacebackground.jpg

静态网站示例 http://bucketname.mycompany.com.s3-website-us-west-1.amazonaws.com/spacebackground(1)Full.jpg

将存储桶更改为静态网站主机后,我会收到“永久重定向”http 响应。

可以同时使用吗?

amazon-s3 amazon-web-services

1
推荐指数
1
解决办法
1714
查看次数

Haskell:无法将预期类型'IO t0'与实际类型'Integer'匹配

当我尝试编译我的代码时,我得到:

[1 of 1] Compiling Main             ( survey2.hs, survey2.o )

survey2.hs:20:1:
    Couldn't match expected type ‘IO t0’ with actual type ‘Integer’
    In the expression: main
    When checking the type of the IO action ‘main’
Run Code Online (Sandbox Code Playgroud)

我已经尝试过将指定'9'输入到main作为一堆不同的类型,包括IO,IO t,IO t0,int等等.我理解基于我在其他地方的函数定义,如果一个Integer没有输入到该函数中,则其他任何函数都无法正常工作.我不确定如何将正确的类型放入主要类型.

factorial:: Integer -> Integer
factorial n
  | n <= 1    = 1 
  | otherwise =  n * factorial(n-1)

binomial :: (Integer, Integer) -> Integer
binomial (n, k)
  | k > n     = 0 
  | k < 0     = 0 
  | otherwise = factorial(n) …
Run Code Online (Sandbox Code Playgroud)

haskell functional-programming type-mismatch

0
推荐指数
1
解决办法
4007
查看次数