0
내가했을 때 : Yesod Handler 내에서 예외를 어떻게 catch 할 수 있습니까?
foos <- (return $ map (encode .> cs .> jsonToFoo body) `catch` r400
나는 다음과 같은 유형의 오류가 발생했습니다 :
/path/to/File.hs:47:78: error:
• Couldn't match type ‘(->) e0’ with ‘IO’
arising from a functional dependency between:
constraint ‘MonadBase IO ((->) e0)’ arising from a use of ‘r400’
instance ‘MonadBase ((->) r) ((->) r)’ at <no location info>
• In the second argument of ‘catch’, namely ‘r400’
In a stmt of a 'do' block:
foos <- (return $ map (encode .> cs .> jsonToFoo) body)
`catch` r400
In the expression:
do { (body :: [Value]) <- requireJsonBody;
foos <- (return $ map (encode .> cs .> jsonToFoo) body)
`catch` r400;
.... }
수있는 방법이 있다면, 그것은 liftIO
그것은하지 않습니다 포함?
[리프팅베이스 패키지 catch''버전]을 사용하여 시도 (https://hackage.haskell.org/package/lifted-base-0.2.3.10/docs/Control-Exception-Lifted.html# v : catch). –
@AlexisKing 감사합니다. – Wizek
@AlexisKing 나는 동일한 유형의 오류 : '형식과 일치 할 수 없습니다 -'IO'' – Wizek