我如何将莎士比亚(来自 yesod)用于服务 Web 服务 API?
我尝试:
type TestAPI
= "tests" :> Get '[JSON] [Test]
:<|> "Test.html" :> Get '[HTML] Html
serverTestAPI :: ServerT TestAPI AppM
serverTestAPI = tests
:<|> test
:<|> testHtml
tests :: AppM [Test]
tests = do return [ Test 1 "Test 1"
, Test 2 "Test 2"
]
testHtml = [hamlet|
$doctype 5
.........
|]
但我得到错误!