expr :: Stream s m Char => ParsecT s u m (Free ClaGate String)
expr = buildExpressionParser opTable term
    <?> "expression"
  where
    opTable =
        [ [prefix "~" (Free . GNot)]
        , [binary "&" (\e1 e2 -> Free $ GAnd e1 e2) AssocLeft]
        , [binary "^" (\e1 e2 -> Free $ GXor e1 e2) AssocLeft]
        , [binary "|" (\e1 e2 -> Free $ GOr e1 e2) AssocLeft]
        ]
    binary  name fun = Infix (do { reservedOp name; return fun })
    prefix  name fun = Prefix (do { reservedOp name; return fun })
    postfix name fun = Postfix (do { reservedOp name; return fun })
expr :: Stream s m Char => ParsecT s u m (Free ClaGate String)
expr = buildExpressionParser opTable term
    <?> "expression"
  where
    opTable =
        [ [prefix "~" (Free . GNot)]
        , [binary "&" (\e1 e2 -> Free $ GAnd e1 e2) AssocLeft]
        , [binary "^" (\e1 e2 -> Free $ GXor e1 e2) AssocLeft]
        , [binary "|" (\e1 e2 -> Free $ GOr e1 e2) AssocLeft]
        ]
    binary  name fun = Infix (do { reservedOp name; return fun })
    prefix  name fun = Prefix (do { reservedOp name; return fun })
    postfix name fun = Postfix (do { reservedOp name; return fun })
expr = buildExpressionParser opTable term
    <?> "expression"
  where
    opTable =
        [ [prefix "~" (Free . GNot)]
        , [binary "&" (\e1 e2 -> Free $ GAnd e1 e2) AssocLeft]
        , [binary "^" (\e1 e2 -> Free $ GXor e1 e2) AssocLeft]
        , [binary "|" (\e1 e2 -> Free $ GOr e1 e2) AssocLeft]
        ]
    binary  name fun = Infix (do { reservedOp name; return fun })
    prefix  name fun = Prefix (do { reservedOp name; return fun })
    postfix name fun = Postfix (do { reservedOp name; return fun })