Skip to content

Instantly share code, notes, and snippets.

@Saizan
Forked from DylanLukes/gist:847423
Created February 28, 2011 15:12
Show Gist options
  • Save Saizan/847437 to your computer and use it in GitHub Desktop.
Save Saizan/847437 to your computer and use it in GitHub Desktop.
{-# 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)
@Saizan
Copy link
Author

Saizan commented Feb 28, 2011

{-# 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment