问题描述
我用它来解码类型良好的 Path
s
pathDecoder f opts =
Decoder
{ extract = extractPath,expected = expectedpath
}
where
filePathDecoder :: Decoder FilePath
filePathDecoder = autoWith opts
extractPath expression =
case extract filePathDecoder expression of
Success x -> case f x of
Left exception -> Dhall.extractError (T.pack $ show exception)
Right path -> Success path
Failure e -> Failure e
expectedpath = expected filePathDecoder
instance FromDhall (Path Abs Dir) where
autoWith options = pathDecoder parseAbsDir options
这有效,但不会在失败时给出非常有用的错误。
Error: Failed extraction
The expression type-checked successfully but the transformation to the target
type Failed with the following error:
InvalidAbsDir "foo/"
这个值可以在任何地方,所以我希望能够看到提取失败的字段名。这是可能的还是我在这里有错误的想法?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)