1
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 :: 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])
4

0 に答える 0