definitions :: ReadP [Def]
definitions = do
  defs <- between emptyDefs
                  emptyDefs
                  (sepBy definition (char defSep >> emptyDefs))
  when (not (null defs)) $ do
    let vars = sort (map fst defs)
        hasDup v [] = False
        hasDup v (v':vs) = v == v' || hasDup v' vs
    when (hasDup (head vars) (tail vars)) pfail
  return defs
  where emptyDefs = do
          skipSpaces
          optional (char defSep >> emptyDefs)
definitions :: ReadP [Def]
definitions = do
  defs <- between emptyDefs
                  emptyDefs
                  (sepBy definition (char defSep >> emptyDefs))
  when (not (null defs)) $ do
    let vars = sort (map fst defs)
        hasDup v [] = False
        hasDup v (v':vs) = v == v' || hasDup v' vs
    when (hasDup (head vars) (tail vars)) pfail
  return defs
  where emptyDefs = do
          skipSpaces
          optional (char defSep >> emptyDefs)
definitions = do
  defs <- between emptyDefs
                  emptyDefs
                  (sepBy definition (char defSep >> emptyDefs))
  when (not (null defs)) $ do
    let vars = sort (map fst defs)
        hasDup v [] = False
        hasDup v (v':vs) = v == v' || hasDup v' vs
    when (hasDup (head vars) (tail vars)) pfail
  return defs
  where emptyDefs = do
          skipSpaces
          optional (char defSep >> emptyDefs)