-
-
Save Saizan/847437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, EmptyDataDecls#-} | |
module Calculator where | |
type Stack = [Double] | |
data Arity = Unary | Binary | |
data Associativity = Left | Right | |
data Operator = Operator Arity Associativity | |
data Expr a where | |
Add :: Expr (Operator Binary Left) | |
Sub :: Expr (Operator Binary Left) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{-# LANGUAGE GADTs, EmptyDataDecls#-}
module Calculator where
type Stack = [Double]
data Unary
data Binary
data Left
data Right
data Operator a b
data Expr a where
Add :: Expr (Operator Binary Left)
Sub :: Expr (Operator Binary Left)