2012/1/3 Yucheng Zhang<[email protected]>


(Hopefully being a little more explicit about this can help you understand where things are going wrong.)

[--snip--]

legSome :: LegGram nt t s ->  nt ->  Either String ([t], s)

The 'nt' you see above

legSome (LegGram g) ntV =
  case Main.lookup ntV g of
     Nothing ->  Left "No word accepted!"
     Just l ->  let sg = legSome (LegGram (Main.delete ntV g))
                   subsome :: [RRule nt t s] ->  Either String ([t], s)

... isn't the same as the 'nt' you see in this line, so it constrains 'subsome' to a different type than the one you intended -- and indeed one which can't be unified with the inferred type. (Unless you use ScopedTypeVariables.)

As Brent suggested, you should probably pull the "subsome" function out into a top-level function in any case.

Cheers,


_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to