{-# LANGUAGE GeneralizedNewtypeDeriving #-}

-- |
-- Module      : Jikka.CPlusPlus.Language.Expr
-- Description : contains data types of C++ language. / C++ のためのデータ型を含みます。
-- Copyright   : (c) Kimiyuki Onaka, 2020
-- License     : Apache License 2.0
-- Maintainer  : kimiyuki95@gmail.com
-- Stability   : experimental
-- Portability : portable
--
-- `Jikka.CPlusPlus.Language.Expr` module has the basic data types for C++ language.
-- The data types are intended to use for the code generation.
module Jikka.CPlusPlus.Language.Expr where

import Data.String (IsString)

newtype VarName = VarName {VarName -> String
unVarName :: String} deriving (VarName -> VarName -> Bool
(VarName -> VarName -> Bool)
-> (VarName -> VarName -> Bool) -> Eq VarName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VarName -> VarName -> Bool
$c/= :: VarName -> VarName -> Bool
== :: VarName -> VarName -> Bool
$c== :: VarName -> VarName -> Bool
Eq, Eq VarName
Eq VarName
-> (VarName -> VarName -> Ordering)
-> (VarName -> VarName -> Bool)
-> (VarName -> VarName -> Bool)
-> (VarName -> VarName -> Bool)
-> (VarName -> VarName -> Bool)
-> (VarName -> VarName -> VarName)
-> (VarName -> VarName -> VarName)
-> Ord VarName
VarName -> VarName -> Bool
VarName -> VarName -> Ordering
VarName -> VarName -> VarName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: VarName -> VarName -> VarName
$cmin :: VarName -> VarName -> VarName
max :: VarName -> VarName -> VarName
$cmax :: VarName -> VarName -> VarName
>= :: VarName -> VarName -> Bool
$c>= :: VarName -> VarName -> Bool
> :: VarName -> VarName -> Bool
$c> :: VarName -> VarName -> Bool
<= :: VarName -> VarName -> Bool
$c<= :: VarName -> VarName -> Bool
< :: VarName -> VarName -> Bool
$c< :: VarName -> VarName -> Bool
compare :: VarName -> VarName -> Ordering
$ccompare :: VarName -> VarName -> Ordering
$cp1Ord :: Eq VarName
Ord, Int -> VarName -> ShowS
[VarName] -> ShowS
VarName -> String
(Int -> VarName -> ShowS)
-> (VarName -> String) -> ([VarName] -> ShowS) -> Show VarName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VarName] -> ShowS
$cshowList :: [VarName] -> ShowS
show :: VarName -> String
$cshow :: VarName -> String
showsPrec :: Int -> VarName -> ShowS
$cshowsPrec :: Int -> VarName -> ShowS
Show, ReadPrec [VarName]
ReadPrec VarName
Int -> ReadS VarName
ReadS [VarName]
(Int -> ReadS VarName)
-> ReadS [VarName]
-> ReadPrec VarName
-> ReadPrec [VarName]
-> Read VarName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VarName]
$creadListPrec :: ReadPrec [VarName]
readPrec :: ReadPrec VarName
$creadPrec :: ReadPrec VarName
readList :: ReadS [VarName]
$creadList :: ReadS [VarName]
readsPrec :: Int -> ReadS VarName
$creadsPrec :: Int -> ReadS VarName
Read, String -> VarName
(String -> VarName) -> IsString VarName
forall a. (String -> a) -> IsString a
fromString :: String -> VarName
$cfromString :: String -> VarName
IsString)

newtype FunName = FunName {FunName -> String
unFunName :: String} deriving (FunName -> FunName -> Bool
(FunName -> FunName -> Bool)
-> (FunName -> FunName -> Bool) -> Eq FunName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunName -> FunName -> Bool
$c/= :: FunName -> FunName -> Bool
== :: FunName -> FunName -> Bool
$c== :: FunName -> FunName -> Bool
Eq, Eq FunName
Eq FunName
-> (FunName -> FunName -> Ordering)
-> (FunName -> FunName -> Bool)
-> (FunName -> FunName -> Bool)
-> (FunName -> FunName -> Bool)
-> (FunName -> FunName -> Bool)
-> (FunName -> FunName -> FunName)
-> (FunName -> FunName -> FunName)
-> Ord FunName
FunName -> FunName -> Bool
FunName -> FunName -> Ordering
FunName -> FunName -> FunName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FunName -> FunName -> FunName
$cmin :: FunName -> FunName -> FunName
max :: FunName -> FunName -> FunName
$cmax :: FunName -> FunName -> FunName
>= :: FunName -> FunName -> Bool
$c>= :: FunName -> FunName -> Bool
> :: FunName -> FunName -> Bool
$c> :: FunName -> FunName -> Bool
<= :: FunName -> FunName -> Bool
$c<= :: FunName -> FunName -> Bool
< :: FunName -> FunName -> Bool
$c< :: FunName -> FunName -> Bool
compare :: FunName -> FunName -> Ordering
$ccompare :: FunName -> FunName -> Ordering
$cp1Ord :: Eq FunName
Ord, Int -> FunName -> ShowS
[FunName] -> ShowS
FunName -> String
(Int -> FunName -> ShowS)
-> (FunName -> String) -> ([FunName] -> ShowS) -> Show FunName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunName] -> ShowS
$cshowList :: [FunName] -> ShowS
show :: FunName -> String
$cshow :: FunName -> String
showsPrec :: Int -> FunName -> ShowS
$cshowsPrec :: Int -> FunName -> ShowS
Show, ReadPrec [FunName]
ReadPrec FunName
Int -> ReadS FunName
ReadS [FunName]
(Int -> ReadS FunName)
-> ReadS [FunName]
-> ReadPrec FunName
-> ReadPrec [FunName]
-> Read FunName
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FunName]
$creadListPrec :: ReadPrec [FunName]
readPrec :: ReadPrec FunName
$creadPrec :: ReadPrec FunName
readList :: ReadS [FunName]
$creadList :: ReadS [FunName]
readsPrec :: Int -> ReadS FunName
$creadsPrec :: Int -> ReadS FunName
Read, String -> FunName
(String -> FunName) -> IsString FunName
forall a. (String -> a) -> IsString a
fromString :: String -> FunName
$cfromString :: String -> FunName
IsString)

data Type
  = TyAuto
  | TyVoid
  | TyBool
  | TyInt
  | TyInt32
  | TyInt64
  | TyTuple [Type]
  | TyVector Type
  | TyArray Type Integer
  | TyString
  | TyFunction Type [Type]
  | TyConvexHullTrick
  | TySegmentTree Monoid'
  | -- | for template parameters
    TyIntValue Integer
  deriving (Type -> Type -> Bool
(Type -> Type -> Bool) -> (Type -> Type -> Bool) -> Eq Type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Type -> Type -> Bool
$c/= :: Type -> Type -> Bool
== :: Type -> Type -> Bool
$c== :: Type -> Type -> Bool
Eq, Eq Type
Eq Type
-> (Type -> Type -> Ordering)
-> (Type -> Type -> Bool)
-> (Type -> Type -> Bool)
-> (Type -> Type -> Bool)
-> (Type -> Type -> Bool)
-> (Type -> Type -> Type)
-> (Type -> Type -> Type)
-> Ord Type
Type -> Type -> Bool
Type -> Type -> Ordering
Type -> Type -> Type
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Type -> Type -> Type
$cmin :: Type -> Type -> Type
max :: Type -> Type -> Type
$cmax :: Type -> Type -> Type
>= :: Type -> Type -> Bool
$c>= :: Type -> Type -> Bool
> :: Type -> Type -> Bool
$c> :: Type -> Type -> Bool
<= :: Type -> Type -> Bool
$c<= :: Type -> Type -> Bool
< :: Type -> Type -> Bool
$c< :: Type -> Type -> Bool
compare :: Type -> Type -> Ordering
$ccompare :: Type -> Type -> Ordering
$cp1Ord :: Eq Type
Ord, Int -> Type -> ShowS
[Type] -> ShowS
Type -> String
(Int -> Type -> ShowS)
-> (Type -> String) -> ([Type] -> ShowS) -> Show Type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Type] -> ShowS
$cshowList :: [Type] -> ShowS
show :: Type -> String
$cshow :: Type -> String
showsPrec :: Int -> Type -> ShowS
$cshowsPrec :: Int -> Type -> ShowS
Show, ReadPrec [Type]
ReadPrec Type
Int -> ReadS Type
ReadS [Type]
(Int -> ReadS Type)
-> ReadS [Type] -> ReadPrec Type -> ReadPrec [Type] -> Read Type
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Type]
$creadListPrec :: ReadPrec [Type]
readPrec :: ReadPrec Type
$creadPrec :: ReadPrec Type
readList :: ReadS [Type]
$creadList :: ReadS [Type]
readsPrec :: Int -> ReadS Type
$creadsPrec :: Int -> ReadS Type
Read)

data Monoid'
  = MonoidIntPlus
  | MonoidIntMin
  | MonoidIntMax
  deriving (Monoid' -> Monoid' -> Bool
(Monoid' -> Monoid' -> Bool)
-> (Monoid' -> Monoid' -> Bool) -> Eq Monoid'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Monoid' -> Monoid' -> Bool
$c/= :: Monoid' -> Monoid' -> Bool
== :: Monoid' -> Monoid' -> Bool
$c== :: Monoid' -> Monoid' -> Bool
Eq, Eq Monoid'
Eq Monoid'
-> (Monoid' -> Monoid' -> Ordering)
-> (Monoid' -> Monoid' -> Bool)
-> (Monoid' -> Monoid' -> Bool)
-> (Monoid' -> Monoid' -> Bool)
-> (Monoid' -> Monoid' -> Bool)
-> (Monoid' -> Monoid' -> Monoid')
-> (Monoid' -> Monoid' -> Monoid')
-> Ord Monoid'
Monoid' -> Monoid' -> Bool
Monoid' -> Monoid' -> Ordering
Monoid' -> Monoid' -> Monoid'
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Monoid' -> Monoid' -> Monoid'
$cmin :: Monoid' -> Monoid' -> Monoid'
max :: Monoid' -> Monoid' -> Monoid'
$cmax :: Monoid' -> Monoid' -> Monoid'
>= :: Monoid' -> Monoid' -> Bool
$c>= :: Monoid' -> Monoid' -> Bool
> :: Monoid' -> Monoid' -> Bool
$c> :: Monoid' -> Monoid' -> Bool
<= :: Monoid' -> Monoid' -> Bool
$c<= :: Monoid' -> Monoid' -> Bool
< :: Monoid' -> Monoid' -> Bool
$c< :: Monoid' -> Monoid' -> Bool
compare :: Monoid' -> Monoid' -> Ordering
$ccompare :: Monoid' -> Monoid' -> Ordering
$cp1Ord :: Eq Monoid'
Ord, Int -> Monoid' -> ShowS
[Monoid'] -> ShowS
Monoid' -> String
(Int -> Monoid' -> ShowS)
-> (Monoid' -> String) -> ([Monoid'] -> ShowS) -> Show Monoid'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Monoid'] -> ShowS
$cshowList :: [Monoid'] -> ShowS
show :: Monoid' -> String
$cshow :: Monoid' -> String
showsPrec :: Int -> Monoid' -> ShowS
$cshowsPrec :: Int -> Monoid' -> ShowS
Show, ReadPrec [Monoid']
ReadPrec Monoid'
Int -> ReadS Monoid'
ReadS [Monoid']
(Int -> ReadS Monoid')
-> ReadS [Monoid']
-> ReadPrec Monoid'
-> ReadPrec [Monoid']
-> Read Monoid'
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Monoid']
$creadListPrec :: ReadPrec [Monoid']
readPrec :: ReadPrec Monoid'
$creadPrec :: ReadPrec Monoid'
readList :: ReadS [Monoid']
$creadList :: ReadS [Monoid']
readsPrec :: Int -> ReadS Monoid'
$creadsPrec :: Int -> ReadS Monoid'
Read)

data Literal
  = LitInt32 Integer
  | LitInt64 Integer
  | LitBool Bool
  | LitChar Char
  | LitString String
  deriving (Literal -> Literal -> Bool
(Literal -> Literal -> Bool)
-> (Literal -> Literal -> Bool) -> Eq Literal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Literal -> Literal -> Bool
$c/= :: Literal -> Literal -> Bool
== :: Literal -> Literal -> Bool
$c== :: Literal -> Literal -> Bool
Eq, Eq Literal
Eq Literal
-> (Literal -> Literal -> Ordering)
-> (Literal -> Literal -> Bool)
-> (Literal -> Literal -> Bool)
-> (Literal -> Literal -> Bool)
-> (Literal -> Literal -> Bool)
-> (Literal -> Literal -> Literal)
-> (Literal -> Literal -> Literal)
-> Ord Literal
Literal -> Literal -> Bool
Literal -> Literal -> Ordering
Literal -> Literal -> Literal
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Literal -> Literal -> Literal
$cmin :: Literal -> Literal -> Literal
max :: Literal -> Literal -> Literal
$cmax :: Literal -> Literal -> Literal
>= :: Literal -> Literal -> Bool
$c>= :: Literal -> Literal -> Bool
> :: Literal -> Literal -> Bool
$c> :: Literal -> Literal -> Bool
<= :: Literal -> Literal -> Bool
$c<= :: Literal -> Literal -> Bool
< :: Literal -> Literal -> Bool
$c< :: Literal -> Literal -> Bool
compare :: Literal -> Literal -> Ordering
$ccompare :: Literal -> Literal -> Ordering
$cp1Ord :: Eq Literal
Ord, Int -> Literal -> ShowS
[Literal] -> ShowS
Literal -> String
(Int -> Literal -> ShowS)
-> (Literal -> String) -> ([Literal] -> ShowS) -> Show Literal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Literal] -> ShowS
$cshowList :: [Literal] -> ShowS
show :: Literal -> String
$cshow :: Literal -> String
showsPrec :: Int -> Literal -> ShowS
$cshowsPrec :: Int -> Literal -> ShowS
Show, ReadPrec [Literal]
ReadPrec Literal
Int -> ReadS Literal
ReadS [Literal]
(Int -> ReadS Literal)
-> ReadS [Literal]
-> ReadPrec Literal
-> ReadPrec [Literal]
-> Read Literal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Literal]
$creadListPrec :: ReadPrec [Literal]
readPrec :: ReadPrec Literal
$creadPrec :: ReadPrec Literal
readList :: ReadS [Literal]
$creadList :: ReadS [Literal]
readsPrec :: Int -> ReadS Literal
$creadsPrec :: Int -> ReadS Literal
Read)

data Function
  = Function FunName [Type]
  | Method FunName
  | At
  | Cast Type
  | StdTuple [Type]
  | StdGet Integer
  | ArrayExt Type
  | VecExt Type
  | VecCtor Type
  | Range
  | MethodSize
  | ConvexHullTrickCtor
  | ConvexHullTrickCopyAddLine
  | SegmentTreeCtor Monoid'
  | SegmentTreeCopySetPoint Monoid'
  deriving (Function -> Function -> Bool
(Function -> Function -> Bool)
-> (Function -> Function -> Bool) -> Eq Function
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Function -> Function -> Bool
$c/= :: Function -> Function -> Bool
== :: Function -> Function -> Bool
$c== :: Function -> Function -> Bool
Eq, Eq Function
Eq Function
-> (Function -> Function -> Ordering)
-> (Function -> Function -> Bool)
-> (Function -> Function -> Bool)
-> (Function -> Function -> Bool)
-> (Function -> Function -> Bool)
-> (Function -> Function -> Function)
-> (Function -> Function -> Function)
-> Ord Function
Function -> Function -> Bool
Function -> Function -> Ordering
Function -> Function -> Function
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Function -> Function -> Function
$cmin :: Function -> Function -> Function
max :: Function -> Function -> Function
$cmax :: Function -> Function -> Function
>= :: Function -> Function -> Bool
$c>= :: Function -> Function -> Bool
> :: Function -> Function -> Bool
$c> :: Function -> Function -> Bool
<= :: Function -> Function -> Bool
$c<= :: Function -> Function -> Bool
< :: Function -> Function -> Bool
$c< :: Function -> Function -> Bool
compare :: Function -> Function -> Ordering
$ccompare :: Function -> Function -> Ordering
$cp1Ord :: Eq Function
Ord, Int -> Function -> ShowS
[Function] -> ShowS
Function -> String
(Int -> Function -> ShowS)
-> (Function -> String) -> ([Function] -> ShowS) -> Show Function
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Function] -> ShowS
$cshowList :: [Function] -> ShowS
show :: Function -> String
$cshow :: Function -> String
showsPrec :: Int -> Function -> ShowS
$cshowsPrec :: Int -> Function -> ShowS
Show, ReadPrec [Function]
ReadPrec Function
Int -> ReadS Function
ReadS [Function]
(Int -> ReadS Function)
-> ReadS [Function]
-> ReadPrec Function
-> ReadPrec [Function]
-> Read Function
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Function]
$creadListPrec :: ReadPrec [Function]
readPrec :: ReadPrec Function
$creadPrec :: ReadPrec Function
readList :: ReadS [Function]
$creadList :: ReadS [Function]
readsPrec :: Int -> ReadS Function
$creadsPrec :: Int -> ReadS Function
Read)

data UnaryOp
  = IntNop
  | Negate
  | BitNot
  | Not
  | Deref
  deriving (UnaryOp -> UnaryOp -> Bool
(UnaryOp -> UnaryOp -> Bool)
-> (UnaryOp -> UnaryOp -> Bool) -> Eq UnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnaryOp -> UnaryOp -> Bool
$c/= :: UnaryOp -> UnaryOp -> Bool
== :: UnaryOp -> UnaryOp -> Bool
$c== :: UnaryOp -> UnaryOp -> Bool
Eq, Eq UnaryOp
Eq UnaryOp
-> (UnaryOp -> UnaryOp -> Ordering)
-> (UnaryOp -> UnaryOp -> Bool)
-> (UnaryOp -> UnaryOp -> Bool)
-> (UnaryOp -> UnaryOp -> Bool)
-> (UnaryOp -> UnaryOp -> Bool)
-> (UnaryOp -> UnaryOp -> UnaryOp)
-> (UnaryOp -> UnaryOp -> UnaryOp)
-> Ord UnaryOp
UnaryOp -> UnaryOp -> Bool
UnaryOp -> UnaryOp -> Ordering
UnaryOp -> UnaryOp -> UnaryOp
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: UnaryOp -> UnaryOp -> UnaryOp
$cmin :: UnaryOp -> UnaryOp -> UnaryOp
max :: UnaryOp -> UnaryOp -> UnaryOp
$cmax :: UnaryOp -> UnaryOp -> UnaryOp
>= :: UnaryOp -> UnaryOp -> Bool
$c>= :: UnaryOp -> UnaryOp -> Bool
> :: UnaryOp -> UnaryOp -> Bool
$c> :: UnaryOp -> UnaryOp -> Bool
<= :: UnaryOp -> UnaryOp -> Bool
$c<= :: UnaryOp -> UnaryOp -> Bool
< :: UnaryOp -> UnaryOp -> Bool
$c< :: UnaryOp -> UnaryOp -> Bool
compare :: UnaryOp -> UnaryOp -> Ordering
$ccompare :: UnaryOp -> UnaryOp -> Ordering
$cp1Ord :: Eq UnaryOp
Ord, Int -> UnaryOp -> ShowS
[UnaryOp] -> ShowS
UnaryOp -> String
(Int -> UnaryOp -> ShowS)
-> (UnaryOp -> String) -> ([UnaryOp] -> ShowS) -> Show UnaryOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnaryOp] -> ShowS
$cshowList :: [UnaryOp] -> ShowS
show :: UnaryOp -> String
$cshow :: UnaryOp -> String
showsPrec :: Int -> UnaryOp -> ShowS
$cshowsPrec :: Int -> UnaryOp -> ShowS
Show, ReadPrec [UnaryOp]
ReadPrec UnaryOp
Int -> ReadS UnaryOp
ReadS [UnaryOp]
(Int -> ReadS UnaryOp)
-> ReadS [UnaryOp]
-> ReadPrec UnaryOp
-> ReadPrec [UnaryOp]
-> Read UnaryOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnaryOp]
$creadListPrec :: ReadPrec [UnaryOp]
readPrec :: ReadPrec UnaryOp
$creadPrec :: ReadPrec UnaryOp
readList :: ReadS [UnaryOp]
$creadList :: ReadS [UnaryOp]
readsPrec :: Int -> ReadS UnaryOp
$creadsPrec :: Int -> ReadS UnaryOp
Read)

data BinaryOp
  = Add
  | Sub
  | Mul
  | Div
  | Mod
  | BitAnd
  | BitOr
  | BitXor
  | BitLeftShift
  | BitRightShift
  | And
  | Or
  | LessThan
  | LessEqual
  | GreaterThan
  | GreaterEqual
  | Equal
  | NotEqual
  deriving (BinaryOp -> BinaryOp -> Bool
(BinaryOp -> BinaryOp -> Bool)
-> (BinaryOp -> BinaryOp -> Bool) -> Eq BinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BinaryOp -> BinaryOp -> Bool
$c/= :: BinaryOp -> BinaryOp -> Bool
== :: BinaryOp -> BinaryOp -> Bool
$c== :: BinaryOp -> BinaryOp -> Bool
Eq, Eq BinaryOp
Eq BinaryOp
-> (BinaryOp -> BinaryOp -> Ordering)
-> (BinaryOp -> BinaryOp -> Bool)
-> (BinaryOp -> BinaryOp -> Bool)
-> (BinaryOp -> BinaryOp -> Bool)
-> (BinaryOp -> BinaryOp -> Bool)
-> (BinaryOp -> BinaryOp -> BinaryOp)
-> (BinaryOp -> BinaryOp -> BinaryOp)
-> Ord BinaryOp
BinaryOp -> BinaryOp -> Bool
BinaryOp -> BinaryOp -> Ordering
BinaryOp -> BinaryOp -> BinaryOp
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: BinaryOp -> BinaryOp -> BinaryOp
$cmin :: BinaryOp -> BinaryOp -> BinaryOp
max :: BinaryOp -> BinaryOp -> BinaryOp
$cmax :: BinaryOp -> BinaryOp -> BinaryOp
>= :: BinaryOp -> BinaryOp -> Bool
$c>= :: BinaryOp -> BinaryOp -> Bool
> :: BinaryOp -> BinaryOp -> Bool
$c> :: BinaryOp -> BinaryOp -> Bool
<= :: BinaryOp -> BinaryOp -> Bool
$c<= :: BinaryOp -> BinaryOp -> Bool
< :: BinaryOp -> BinaryOp -> Bool
$c< :: BinaryOp -> BinaryOp -> Bool
compare :: BinaryOp -> BinaryOp -> Ordering
$ccompare :: BinaryOp -> BinaryOp -> Ordering
$cp1Ord :: Eq BinaryOp
Ord, Int -> BinaryOp -> ShowS
[BinaryOp] -> ShowS
BinaryOp -> String
(Int -> BinaryOp -> ShowS)
-> (BinaryOp -> String) -> ([BinaryOp] -> ShowS) -> Show BinaryOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BinaryOp] -> ShowS
$cshowList :: [BinaryOp] -> ShowS
show :: BinaryOp -> String
$cshow :: BinaryOp -> String
showsPrec :: Int -> BinaryOp -> ShowS
$cshowsPrec :: Int -> BinaryOp -> ShowS
Show, ReadPrec [BinaryOp]
ReadPrec BinaryOp
Int -> ReadS BinaryOp
ReadS [BinaryOp]
(Int -> ReadS BinaryOp)
-> ReadS [BinaryOp]
-> ReadPrec BinaryOp
-> ReadPrec [BinaryOp]
-> Read BinaryOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BinaryOp]
$creadListPrec :: ReadPrec [BinaryOp]
readPrec :: ReadPrec BinaryOp
$creadPrec :: ReadPrec BinaryOp
readList :: ReadS [BinaryOp]
$creadList :: ReadS [BinaryOp]
readsPrec :: Int -> ReadS BinaryOp
$creadsPrec :: Int -> ReadS BinaryOp
Read)

data AssignOp
  = SimpleAssign
  | AddAssign
  | SubAssign
  | MulAssign
  | DivAssign
  | ModAssign
  | BitLeftShiftAssign
  | BitRightShiftAssign
  | BitAndAssign
  | BitOrAssign
  | BitXorAssign
  deriving (AssignOp -> AssignOp -> Bool
(AssignOp -> AssignOp -> Bool)
-> (AssignOp -> AssignOp -> Bool) -> Eq AssignOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssignOp -> AssignOp -> Bool
$c/= :: AssignOp -> AssignOp -> Bool
== :: AssignOp -> AssignOp -> Bool
$c== :: AssignOp -> AssignOp -> Bool
Eq, Eq AssignOp
Eq AssignOp
-> (AssignOp -> AssignOp -> Ordering)
-> (AssignOp -> AssignOp -> Bool)
-> (AssignOp -> AssignOp -> Bool)
-> (AssignOp -> AssignOp -> Bool)
-> (AssignOp -> AssignOp -> Bool)
-> (AssignOp -> AssignOp -> AssignOp)
-> (AssignOp -> AssignOp -> AssignOp)
-> Ord AssignOp
AssignOp -> AssignOp -> Bool
AssignOp -> AssignOp -> Ordering
AssignOp -> AssignOp -> AssignOp
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AssignOp -> AssignOp -> AssignOp
$cmin :: AssignOp -> AssignOp -> AssignOp
max :: AssignOp -> AssignOp -> AssignOp
$cmax :: AssignOp -> AssignOp -> AssignOp
>= :: AssignOp -> AssignOp -> Bool
$c>= :: AssignOp -> AssignOp -> Bool
> :: AssignOp -> AssignOp -> Bool
$c> :: AssignOp -> AssignOp -> Bool
<= :: AssignOp -> AssignOp -> Bool
$c<= :: AssignOp -> AssignOp -> Bool
< :: AssignOp -> AssignOp -> Bool
$c< :: AssignOp -> AssignOp -> Bool
compare :: AssignOp -> AssignOp -> Ordering
$ccompare :: AssignOp -> AssignOp -> Ordering
$cp1Ord :: Eq AssignOp
Ord, Int -> AssignOp -> ShowS
[AssignOp] -> ShowS
AssignOp -> String
(Int -> AssignOp -> ShowS)
-> (AssignOp -> String) -> ([AssignOp] -> ShowS) -> Show AssignOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssignOp] -> ShowS
$cshowList :: [AssignOp] -> ShowS
show :: AssignOp -> String
$cshow :: AssignOp -> String
showsPrec :: Int -> AssignOp -> ShowS
$cshowsPrec :: Int -> AssignOp -> ShowS
Show, ReadPrec [AssignOp]
ReadPrec AssignOp
Int -> ReadS AssignOp
ReadS [AssignOp]
(Int -> ReadS AssignOp)
-> ReadS [AssignOp]
-> ReadPrec AssignOp
-> ReadPrec [AssignOp]
-> Read AssignOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssignOp]
$creadListPrec :: ReadPrec [AssignOp]
readPrec :: ReadPrec AssignOp
$creadPrec :: ReadPrec AssignOp
readList :: ReadS [AssignOp]
$creadList :: ReadS [AssignOp]
readsPrec :: Int -> ReadS AssignOp
$creadsPrec :: Int -> ReadS AssignOp
Read)

data Expr
  = Var VarName
  | Lit Literal
  | UnOp UnaryOp Expr
  | BinOp BinaryOp Expr Expr
  | Cond Expr Expr Expr
  | Lam [(Type, VarName)] Type [Statement]
  | Call Function [Expr]
  | CallExpr Expr [Expr]
  deriving (Expr -> Expr -> Bool
(Expr -> Expr -> Bool) -> (Expr -> Expr -> Bool) -> Eq Expr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Expr -> Expr -> Bool
$c/= :: Expr -> Expr -> Bool
== :: Expr -> Expr -> Bool
$c== :: Expr -> Expr -> Bool
Eq, Eq Expr
Eq Expr
-> (Expr -> Expr -> Ordering)
-> (Expr -> Expr -> Bool)
-> (Expr -> Expr -> Bool)
-> (Expr -> Expr -> Bool)
-> (Expr -> Expr -> Bool)
-> (Expr -> Expr -> Expr)
-> (Expr -> Expr -> Expr)
-> Ord Expr
Expr -> Expr -> Bool
Expr -> Expr -> Ordering
Expr -> Expr -> Expr
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Expr -> Expr -> Expr
$cmin :: Expr -> Expr -> Expr
max :: Expr -> Expr -> Expr
$cmax :: Expr -> Expr -> Expr
>= :: Expr -> Expr -> Bool
$c>= :: Expr -> Expr -> Bool
> :: Expr -> Expr -> Bool
$c> :: Expr -> Expr -> Bool
<= :: Expr -> Expr -> Bool
$c<= :: Expr -> Expr -> Bool
< :: Expr -> Expr -> Bool
$c< :: Expr -> Expr -> Bool
compare :: Expr -> Expr -> Ordering
$ccompare :: Expr -> Expr -> Ordering
$cp1Ord :: Eq Expr
Ord, Int -> Expr -> ShowS
[Expr] -> ShowS
Expr -> String
(Int -> Expr -> ShowS)
-> (Expr -> String) -> ([Expr] -> ShowS) -> Show Expr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Expr] -> ShowS
$cshowList :: [Expr] -> ShowS
show :: Expr -> String
$cshow :: Expr -> String
showsPrec :: Int -> Expr -> ShowS
$cshowsPrec :: Int -> Expr -> ShowS
Show, ReadPrec [Expr]
ReadPrec Expr
Int -> ReadS Expr
ReadS [Expr]
(Int -> ReadS Expr)
-> ReadS [Expr] -> ReadPrec Expr -> ReadPrec [Expr] -> Read Expr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Expr]
$creadListPrec :: ReadPrec [Expr]
readPrec :: ReadPrec Expr
$creadPrec :: ReadPrec Expr
readList :: ReadS [Expr]
$creadList :: ReadS [Expr]
readsPrec :: Int -> ReadS Expr
$creadsPrec :: Int -> ReadS Expr
Read)

data LeftExpr
  = LeftVar VarName
  | LeftAt LeftExpr Expr
  | -- | @std::get<n>@
    LeftGet Integer LeftExpr
  deriving (LeftExpr -> LeftExpr -> Bool
(LeftExpr -> LeftExpr -> Bool)
-> (LeftExpr -> LeftExpr -> Bool) -> Eq LeftExpr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LeftExpr -> LeftExpr -> Bool
$c/= :: LeftExpr -> LeftExpr -> Bool
== :: LeftExpr -> LeftExpr -> Bool
$c== :: LeftExpr -> LeftExpr -> Bool
Eq, Eq LeftExpr
Eq LeftExpr
-> (LeftExpr -> LeftExpr -> Ordering)
-> (LeftExpr -> LeftExpr -> Bool)
-> (LeftExpr -> LeftExpr -> Bool)
-> (LeftExpr -> LeftExpr -> Bool)
-> (LeftExpr -> LeftExpr -> Bool)
-> (LeftExpr -> LeftExpr -> LeftExpr)
-> (LeftExpr -> LeftExpr -> LeftExpr)
-> Ord LeftExpr
LeftExpr -> LeftExpr -> Bool
LeftExpr -> LeftExpr -> Ordering
LeftExpr -> LeftExpr -> LeftExpr
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LeftExpr -> LeftExpr -> LeftExpr
$cmin :: LeftExpr -> LeftExpr -> LeftExpr
max :: LeftExpr -> LeftExpr -> LeftExpr
$cmax :: LeftExpr -> LeftExpr -> LeftExpr
>= :: LeftExpr -> LeftExpr -> Bool
$c>= :: LeftExpr -> LeftExpr -> Bool
> :: LeftExpr -> LeftExpr -> Bool
$c> :: LeftExpr -> LeftExpr -> Bool
<= :: LeftExpr -> LeftExpr -> Bool
$c<= :: LeftExpr -> LeftExpr -> Bool
< :: LeftExpr -> LeftExpr -> Bool
$c< :: LeftExpr -> LeftExpr -> Bool
compare :: LeftExpr -> LeftExpr -> Ordering
$ccompare :: LeftExpr -> LeftExpr -> Ordering
$cp1Ord :: Eq LeftExpr
Ord, Int -> LeftExpr -> ShowS
[LeftExpr] -> ShowS
LeftExpr -> String
(Int -> LeftExpr -> ShowS)
-> (LeftExpr -> String) -> ([LeftExpr] -> ShowS) -> Show LeftExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LeftExpr] -> ShowS
$cshowList :: [LeftExpr] -> ShowS
show :: LeftExpr -> String
$cshow :: LeftExpr -> String
showsPrec :: Int -> LeftExpr -> ShowS
$cshowsPrec :: Int -> LeftExpr -> ShowS
Show, ReadPrec [LeftExpr]
ReadPrec LeftExpr
Int -> ReadS LeftExpr
ReadS [LeftExpr]
(Int -> ReadS LeftExpr)
-> ReadS [LeftExpr]
-> ReadPrec LeftExpr
-> ReadPrec [LeftExpr]
-> Read LeftExpr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LeftExpr]
$creadListPrec :: ReadPrec [LeftExpr]
readPrec :: ReadPrec LeftExpr
$creadPrec :: ReadPrec LeftExpr
readList :: ReadS [LeftExpr]
$creadList :: ReadS [LeftExpr]
readsPrec :: Int -> ReadS LeftExpr
$creadsPrec :: Int -> ReadS LeftExpr
Read)

data AssignExpr
  = AssignExpr AssignOp LeftExpr Expr
  | AssignIncr LeftExpr
  | AssignDecr LeftExpr
  deriving (AssignExpr -> AssignExpr -> Bool
(AssignExpr -> AssignExpr -> Bool)
-> (AssignExpr -> AssignExpr -> Bool) -> Eq AssignExpr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssignExpr -> AssignExpr -> Bool
$c/= :: AssignExpr -> AssignExpr -> Bool
== :: AssignExpr -> AssignExpr -> Bool
$c== :: AssignExpr -> AssignExpr -> Bool
Eq, Eq AssignExpr
Eq AssignExpr
-> (AssignExpr -> AssignExpr -> Ordering)
-> (AssignExpr -> AssignExpr -> Bool)
-> (AssignExpr -> AssignExpr -> Bool)
-> (AssignExpr -> AssignExpr -> Bool)
-> (AssignExpr -> AssignExpr -> Bool)
-> (AssignExpr -> AssignExpr -> AssignExpr)
-> (AssignExpr -> AssignExpr -> AssignExpr)
-> Ord AssignExpr
AssignExpr -> AssignExpr -> Bool
AssignExpr -> AssignExpr -> Ordering
AssignExpr -> AssignExpr -> AssignExpr
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AssignExpr -> AssignExpr -> AssignExpr
$cmin :: AssignExpr -> AssignExpr -> AssignExpr
max :: AssignExpr -> AssignExpr -> AssignExpr
$cmax :: AssignExpr -> AssignExpr -> AssignExpr
>= :: AssignExpr -> AssignExpr -> Bool
$c>= :: AssignExpr -> AssignExpr -> Bool
> :: AssignExpr -> AssignExpr -> Bool
$c> :: AssignExpr -> AssignExpr -> Bool
<= :: AssignExpr -> AssignExpr -> Bool
$c<= :: AssignExpr -> AssignExpr -> Bool
< :: AssignExpr -> AssignExpr -> Bool
$c< :: AssignExpr -> AssignExpr -> Bool
compare :: AssignExpr -> AssignExpr -> Ordering
$ccompare :: AssignExpr -> AssignExpr -> Ordering
$cp1Ord :: Eq AssignExpr
Ord, Int -> AssignExpr -> ShowS
[AssignExpr] -> ShowS
AssignExpr -> String
(Int -> AssignExpr -> ShowS)
-> (AssignExpr -> String)
-> ([AssignExpr] -> ShowS)
-> Show AssignExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssignExpr] -> ShowS
$cshowList :: [AssignExpr] -> ShowS
show :: AssignExpr -> String
$cshow :: AssignExpr -> String
showsPrec :: Int -> AssignExpr -> ShowS
$cshowsPrec :: Int -> AssignExpr -> ShowS
Show, ReadPrec [AssignExpr]
ReadPrec AssignExpr
Int -> ReadS AssignExpr
ReadS [AssignExpr]
(Int -> ReadS AssignExpr)
-> ReadS [AssignExpr]
-> ReadPrec AssignExpr
-> ReadPrec [AssignExpr]
-> Read AssignExpr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssignExpr]
$creadListPrec :: ReadPrec [AssignExpr]
readPrec :: ReadPrec AssignExpr
$creadPrec :: ReadPrec AssignExpr
readList :: ReadS [AssignExpr]
$creadList :: ReadS [AssignExpr]
readsPrec :: Int -> ReadS AssignExpr
$creadsPrec :: Int -> ReadS AssignExpr
Read)

data DeclareRight
  = DeclareDefault
  | DeclareCopy Expr
  | -- | This is only for better formatting. This should not be used while optimization phases.
    DeclareInitialize [Expr]
  deriving (DeclareRight -> DeclareRight -> Bool
(DeclareRight -> DeclareRight -> Bool)
-> (DeclareRight -> DeclareRight -> Bool) -> Eq DeclareRight
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeclareRight -> DeclareRight -> Bool
$c/= :: DeclareRight -> DeclareRight -> Bool
== :: DeclareRight -> DeclareRight -> Bool
$c== :: DeclareRight -> DeclareRight -> Bool
Eq, Eq DeclareRight
Eq DeclareRight
-> (DeclareRight -> DeclareRight -> Ordering)
-> (DeclareRight -> DeclareRight -> Bool)
-> (DeclareRight -> DeclareRight -> Bool)
-> (DeclareRight -> DeclareRight -> Bool)
-> (DeclareRight -> DeclareRight -> Bool)
-> (DeclareRight -> DeclareRight -> DeclareRight)
-> (DeclareRight -> DeclareRight -> DeclareRight)
-> Ord DeclareRight
DeclareRight -> DeclareRight -> Bool
DeclareRight -> DeclareRight -> Ordering
DeclareRight -> DeclareRight -> DeclareRight
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DeclareRight -> DeclareRight -> DeclareRight
$cmin :: DeclareRight -> DeclareRight -> DeclareRight
max :: DeclareRight -> DeclareRight -> DeclareRight
$cmax :: DeclareRight -> DeclareRight -> DeclareRight
>= :: DeclareRight -> DeclareRight -> Bool
$c>= :: DeclareRight -> DeclareRight -> Bool
> :: DeclareRight -> DeclareRight -> Bool
$c> :: DeclareRight -> DeclareRight -> Bool
<= :: DeclareRight -> DeclareRight -> Bool
$c<= :: DeclareRight -> DeclareRight -> Bool
< :: DeclareRight -> DeclareRight -> Bool
$c< :: DeclareRight -> DeclareRight -> Bool
compare :: DeclareRight -> DeclareRight -> Ordering
$ccompare :: DeclareRight -> DeclareRight -> Ordering
$cp1Ord :: Eq DeclareRight
Ord, Int -> DeclareRight -> ShowS
[DeclareRight] -> ShowS
DeclareRight -> String
(Int -> DeclareRight -> ShowS)
-> (DeclareRight -> String)
-> ([DeclareRight] -> ShowS)
-> Show DeclareRight
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeclareRight] -> ShowS
$cshowList :: [DeclareRight] -> ShowS
show :: DeclareRight -> String
$cshow :: DeclareRight -> String
showsPrec :: Int -> DeclareRight -> ShowS
$cshowsPrec :: Int -> DeclareRight -> ShowS
Show, ReadPrec [DeclareRight]
ReadPrec DeclareRight
Int -> ReadS DeclareRight
ReadS [DeclareRight]
(Int -> ReadS DeclareRight)
-> ReadS [DeclareRight]
-> ReadPrec DeclareRight
-> ReadPrec [DeclareRight]
-> Read DeclareRight
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeclareRight]
$creadListPrec :: ReadPrec [DeclareRight]
readPrec :: ReadPrec DeclareRight
$creadPrec :: ReadPrec DeclareRight
readList :: ReadS [DeclareRight]
$creadList :: ReadS [DeclareRight]
readsPrec :: Int -> ReadS DeclareRight
$creadsPrec :: Int -> ReadS DeclareRight
Read)

data Statement
  = ExprStatement Expr
  | Block [Statement]
  | If Expr [Statement] (Maybe [Statement])
  | For Type VarName Expr Expr AssignExpr [Statement]
  | ForEach Type VarName Expr [Statement]
  | While Expr [Statement]
  | Declare Type VarName DeclareRight
  | DeclareDestructure [VarName] Expr
  | Assign AssignExpr
  | Assert Expr
  | Return Expr
  deriving (Statement -> Statement -> Bool
(Statement -> Statement -> Bool)
-> (Statement -> Statement -> Bool) -> Eq Statement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Statement -> Statement -> Bool
$c/= :: Statement -> Statement -> Bool
== :: Statement -> Statement -> Bool
$c== :: Statement -> Statement -> Bool
Eq, Eq Statement
Eq Statement
-> (Statement -> Statement -> Ordering)
-> (Statement -> Statement -> Bool)
-> (Statement -> Statement -> Bool)
-> (Statement -> Statement -> Bool)
-> (Statement -> Statement -> Bool)
-> (Statement -> Statement -> Statement)
-> (Statement -> Statement -> Statement)
-> Ord Statement
Statement -> Statement -> Bool
Statement -> Statement -> Ordering
Statement -> Statement -> Statement
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Statement -> Statement -> Statement
$cmin :: Statement -> Statement -> Statement
max :: Statement -> Statement -> Statement
$cmax :: Statement -> Statement -> Statement
>= :: Statement -> Statement -> Bool
$c>= :: Statement -> Statement -> Bool
> :: Statement -> Statement -> Bool
$c> :: Statement -> Statement -> Bool
<= :: Statement -> Statement -> Bool
$c<= :: Statement -> Statement -> Bool
< :: Statement -> Statement -> Bool
$c< :: Statement -> Statement -> Bool
compare :: Statement -> Statement -> Ordering
$ccompare :: Statement -> Statement -> Ordering
$cp1Ord :: Eq Statement
Ord, Int -> Statement -> ShowS
[Statement] -> ShowS
Statement -> String
(Int -> Statement -> ShowS)
-> (Statement -> String)
-> ([Statement] -> ShowS)
-> Show Statement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Statement] -> ShowS
$cshowList :: [Statement] -> ShowS
show :: Statement -> String
$cshow :: Statement -> String
showsPrec :: Int -> Statement -> ShowS
$cshowsPrec :: Int -> Statement -> ShowS
Show, ReadPrec [Statement]
ReadPrec Statement
Int -> ReadS Statement
ReadS [Statement]
(Int -> ReadS Statement)
-> ReadS [Statement]
-> ReadPrec Statement
-> ReadPrec [Statement]
-> Read Statement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Statement]
$creadListPrec :: ReadPrec [Statement]
readPrec :: ReadPrec Statement
$creadPrec :: ReadPrec Statement
readList :: ReadS [Statement]
$creadList :: ReadS [Statement]
readsPrec :: Int -> ReadS Statement
$creadsPrec :: Int -> ReadS Statement
Read)

data ToplevelStatement
  = VarDef Type VarName Expr
  | FunDef Type VarName [(Type, VarName)] [Statement]
  deriving (ToplevelStatement -> ToplevelStatement -> Bool
(ToplevelStatement -> ToplevelStatement -> Bool)
-> (ToplevelStatement -> ToplevelStatement -> Bool)
-> Eq ToplevelStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ToplevelStatement -> ToplevelStatement -> Bool
$c/= :: ToplevelStatement -> ToplevelStatement -> Bool
== :: ToplevelStatement -> ToplevelStatement -> Bool
$c== :: ToplevelStatement -> ToplevelStatement -> Bool
Eq, Eq ToplevelStatement
Eq ToplevelStatement
-> (ToplevelStatement -> ToplevelStatement -> Ordering)
-> (ToplevelStatement -> ToplevelStatement -> Bool)
-> (ToplevelStatement -> ToplevelStatement -> Bool)
-> (ToplevelStatement -> ToplevelStatement -> Bool)
-> (ToplevelStatement -> ToplevelStatement -> Bool)
-> (ToplevelStatement -> ToplevelStatement -> ToplevelStatement)
-> (ToplevelStatement -> ToplevelStatement -> ToplevelStatement)
-> Ord ToplevelStatement
ToplevelStatement -> ToplevelStatement -> Bool
ToplevelStatement -> ToplevelStatement -> Ordering
ToplevelStatement -> ToplevelStatement -> ToplevelStatement
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ToplevelStatement -> ToplevelStatement -> ToplevelStatement
$cmin :: ToplevelStatement -> ToplevelStatement -> ToplevelStatement
max :: ToplevelStatement -> ToplevelStatement -> ToplevelStatement
$cmax :: ToplevelStatement -> ToplevelStatement -> ToplevelStatement
>= :: ToplevelStatement -> ToplevelStatement -> Bool
$c>= :: ToplevelStatement -> ToplevelStatement -> Bool
> :: ToplevelStatement -> ToplevelStatement -> Bool
$c> :: ToplevelStatement -> ToplevelStatement -> Bool
<= :: ToplevelStatement -> ToplevelStatement -> Bool
$c<= :: ToplevelStatement -> ToplevelStatement -> Bool
< :: ToplevelStatement -> ToplevelStatement -> Bool
$c< :: ToplevelStatement -> ToplevelStatement -> Bool
compare :: ToplevelStatement -> ToplevelStatement -> Ordering
$ccompare :: ToplevelStatement -> ToplevelStatement -> Ordering
$cp1Ord :: Eq ToplevelStatement
Ord, Int -> ToplevelStatement -> ShowS
[ToplevelStatement] -> ShowS
ToplevelStatement -> String
(Int -> ToplevelStatement -> ShowS)
-> (ToplevelStatement -> String)
-> ([ToplevelStatement] -> ShowS)
-> Show ToplevelStatement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ToplevelStatement] -> ShowS
$cshowList :: [ToplevelStatement] -> ShowS
show :: ToplevelStatement -> String
$cshow :: ToplevelStatement -> String
showsPrec :: Int -> ToplevelStatement -> ShowS
$cshowsPrec :: Int -> ToplevelStatement -> ShowS
Show, ReadPrec [ToplevelStatement]
ReadPrec ToplevelStatement
Int -> ReadS ToplevelStatement
ReadS [ToplevelStatement]
(Int -> ReadS ToplevelStatement)
-> ReadS [ToplevelStatement]
-> ReadPrec ToplevelStatement
-> ReadPrec [ToplevelStatement]
-> Read ToplevelStatement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ToplevelStatement]
$creadListPrec :: ReadPrec [ToplevelStatement]
readPrec :: ReadPrec ToplevelStatement
$creadPrec :: ReadPrec ToplevelStatement
readList :: ReadS [ToplevelStatement]
$creadList :: ReadS [ToplevelStatement]
readsPrec :: Int -> ReadS ToplevelStatement
$creadsPrec :: Int -> ReadS ToplevelStatement
Read)

newtype Program = Program
  { Program -> [ToplevelStatement]
decls :: [ToplevelStatement]
  }
  deriving (Program -> Program -> Bool
(Program -> Program -> Bool)
-> (Program -> Program -> Bool) -> Eq Program
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Program -> Program -> Bool
$c/= :: Program -> Program -> Bool
== :: Program -> Program -> Bool
$c== :: Program -> Program -> Bool
Eq, Eq Program
Eq Program
-> (Program -> Program -> Ordering)
-> (Program -> Program -> Bool)
-> (Program -> Program -> Bool)
-> (Program -> Program -> Bool)
-> (Program -> Program -> Bool)
-> (Program -> Program -> Program)
-> (Program -> Program -> Program)
-> Ord Program
Program -> Program -> Bool
Program -> Program -> Ordering
Program -> Program -> Program
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Program -> Program -> Program
$cmin :: Program -> Program -> Program
max :: Program -> Program -> Program
$cmax :: Program -> Program -> Program
>= :: Program -> Program -> Bool
$c>= :: Program -> Program -> Bool
> :: Program -> Program -> Bool
$c> :: Program -> Program -> Bool
<= :: Program -> Program -> Bool
$c<= :: Program -> Program -> Bool
< :: Program -> Program -> Bool
$c< :: Program -> Program -> Bool
compare :: Program -> Program -> Ordering
$ccompare :: Program -> Program -> Ordering
$cp1Ord :: Eq Program
Ord, Int -> Program -> ShowS
[Program] -> ShowS
Program -> String
(Int -> Program -> ShowS)
-> (Program -> String) -> ([Program] -> ShowS) -> Show Program
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Program] -> ShowS
$cshowList :: [Program] -> ShowS
show :: Program -> String
$cshow :: Program -> String
showsPrec :: Int -> Program -> ShowS
$cshowsPrec :: Int -> Program -> ShowS
Show, ReadPrec [Program]
ReadPrec Program
Int -> ReadS Program
ReadS [Program]
(Int -> ReadS Program)
-> ReadS [Program]
-> ReadPrec Program
-> ReadPrec [Program]
-> Read Program
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Program]
$creadListPrec :: ReadPrec [Program]
readPrec :: ReadPrec Program
$creadPrec :: ReadPrec Program
readList :: ReadS [Program]
$creadList :: ReadS [Program]
readsPrec :: Int -> ReadS Program
$creadsPrec :: Int -> ReadS Program
Read)