1
이 오류 메시지를 이해하는 데 문제가 있습니다. 다음에 조사해야 할 사항이 없습니다. 'param'을 사용하여 발생하는 모호한 유형 변수 'a0'은 '(Parsable a0)'제약 조건을 해결하지 못합니다.
나는 다음과 같은 수입있어 :{-# LANGUAGE OverloadedStrings #-}
module Main where
import Web.Scotty
import Control.Applicative
import Control.Monad.IO.Class
import Database.SQLite.Simple
import Database.SQLite.Simple.FromRow
import qualified Data.Text.Lazy as L
코드 오류의 원인 :
routes :: ScottyM()
routes = do
post "/create" $ do
f <- param ("fa" :: L.Text)
file "create.html"
그리고 오류 : Parseable a => Text -> ActionM a
을 입력 한
• Ambiguous type variable ‘a0’ arising from a use of ‘param’
prevents the constraint ‘(Parsable a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance Parsable Integer
-- Defined in ‘scotty-0.11.0:Web.Scotty.Action’
instance Parsable L.Text
-- Defined in ‘scotty-0.11.0:Web.Scotty.Action’
instance Parsable()
-- Defined in ‘scotty-0.11.0:Web.Scotty.Action’
...plus 7 others
...plus 12 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block: f <- param ("f" :: L.Text)
In the second argument of ‘($)’, namely
‘do { f <- param ("f" :: L.Text);
file "create.html" }’
In a stmt of a 'do' block:
post "/create"
$ do { f <- param ("f" :: L.Text);
file "create.html" }