Duplicate row error, how to unify generic row types

279 views Asked by At
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

I've twisted my brain, but I don't see how to unify the types here. All was well on the earlier version of PureScript. But in 0.6 I'm stuck.

--

Details on Parse

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

More type info

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

There are 0 answers