重复行错误,如何统一通用行类型

时间:2014-11-22 03:02:27

标签: purescript

renderYaml :: forall a p e. 
  Yaml -> Registry p a (err :: Exception | e) -> Eff (err :: Exception | e) Unit
renderYaml yaml r = let 

    yamlToForeign  :: Yaml -> Either String Foreign
    yamlToForeign  = runFn3 parseYaml Left Right

    -- Without the explicit type here, psc throws:
    -- Error in declaration renderYaml
    -- Error in expression Presentable.ViewParser.parse(v):
    -- Duplicate label "err" in row.
    grrinference   :: forall e. Foreign -> Eff (err :: Exception | e) Unit
    -- with the explicit type, psc throws:
    -- Error in declaration renderYaml
    -- Cannot unify ( | e10478) with ( | e10503)
    grrinference v = parse v r >>= render

  in case yamlToForeign yaml of
    Right v  -> grrinference v
    Left err -> throw $ "Yaml view failed to parse : " ++ err

我扭曲了我的大脑,但我不知道如何统一这里的类型。一切都很好的早期版本的PureScript。但在0.6我被卡住了。

-

Parse的详细信息

parse :: forall a p e. Foreign -> Registry a p e-> Eff (err :: Exception | e) [Presentable a p e]

更多类型信息

type Yaml              = String
type Registry a p e    = M.Map String (Linker a p e)
type Attributes a      = Maybe { | a}
type Parent p          = Maybe { | p}
type Linker a p e      = Parent p -> Attributes a -> Eff e (Parent p)

data Presentable a p e = Presentable (Linker a p e) (Attributes a) (Maybe [Presentable a p e])

0 个答案:

没有答案