value :: IParser Var.Value
value =
    val <|> tipe <?> "a value or type to expose"
  where
    val =
      (Var.Value <$> lowVar) <|> (Var.OpValue <$> parens' symOp)

    tipe =
      do  name <- capVar
          maybeCtors <- optionMaybe (try $ (,) <$> whitespace <*> listing (commentedSet capVar))
          case maybeCtors of
            Nothing -> return $ Var.Union (name, []) Var.ClosedListing
            Just (pre, ctors) -> return (Var.Union (name, pre) ctors)
value :: IParser Var.Value
value =
    val <|> tipe <?> "a value or type to expose"
  where
    val =
      (Var.Value <$> lowVar) <|> (Var.OpValue <$> parens' symOp)

    tipe =
      do  name <- capVar
          maybeCtors <- optionMaybe (try $ (,) <$> whitespace <*> listing (commentedSet capVar))
          case maybeCtors of
            Nothing -> return $ Var.Union (name, []) Var.ClosedListing
            Just (pre, ctors) -> return (Var.Union (name, pre) ctors)
value =
    val <|> tipe <?> "a value or type to expose"
  where
    val =
      (Var.Value <$> lowVar) <|> (Var.OpValue <$> parens' symOp)

    tipe =
      do  name <- capVar
          maybeCtors <- optionMaybe (try $ (,) <$> whitespace <*> listing (commentedSet capVar))
          case maybeCtors of
            Nothing -> return $ Var.Union (name, []) Var.ClosedListing
            Just (pre, ctors) -> return (Var.Union (name, pre) ctors)