{-# LANGUAGE Strict #-}
{-# LANGUAGE TypeFamilies #-}
module Futhark.IR.Syntax
( module Language.Futhark.Core,
prettyString,
prettyText,
Pretty,
module Futhark.IR.Rep,
module Futhark.IR.Syntax.Core,
Uniqueness (..),
NoUniqueness (..),
Rank (..),
ArrayShape (..),
Space (..),
TypeBase (..),
Diet (..),
Ident (..),
SubExp (..),
PatElem (..),
Pat (..),
StmAux (..),
Stm (..),
Stms,
SubExpRes (..),
Result,
Body (..),
BasicOp (..),
UnOp (..),
BinOp (..),
CmpOp (..),
ConvOp (..),
OpaqueOp (..),
ReshapeKind (..),
WithAccInput,
Exp (..),
Case (..),
LoopForm (..),
MatchDec (..),
MatchSort (..),
Safety (..),
Lambda (..),
RetAls (..),
Param (..),
FParam,
LParam,
FunDef (..),
EntryParam (..),
EntryResult (..),
EntryPoint,
Prog (..),
oneStm,
stmsFromList,
stmsToList,
stmsHead,
stmsLast,
subExpRes,
subExpsRes,
varRes,
varsRes,
subExpResVName,
)
where
import Control.Category
import Data.Foldable
import Data.List.NonEmpty (NonEmpty (..))
import Data.Sequence qualified as Seq
import Data.Text qualified as T
import Data.Traversable (fmapDefault, foldMapDefault)
import Futhark.IR.Rep
import Futhark.IR.Syntax.Core
import Futhark.Util.Pretty (Pretty, prettyString, prettyText)
import Language.Futhark.Core
import Prelude hiding (id, (.))
newtype Pat dec = Pat {forall dec. Pat dec -> [PatElem dec]
patElems :: [PatElem dec]}
deriving (Eq (Pat dec)
Eq (Pat dec) =>
(Pat dec -> Pat dec -> Ordering)
-> (Pat dec -> Pat dec -> Bool)
-> (Pat dec -> Pat dec -> Bool)
-> (Pat dec -> Pat dec -> Bool)
-> (Pat dec -> Pat dec -> Bool)
-> (Pat dec -> Pat dec -> Pat dec)
-> (Pat dec -> Pat dec -> Pat dec)
-> Ord (Pat dec)
Pat dec -> Pat dec -> Bool
Pat dec -> Pat dec -> Ordering
Pat dec -> Pat dec -> Pat dec
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
forall dec. Ord dec => Eq (Pat dec)
forall dec. Ord dec => Pat dec -> Pat dec -> Bool
forall dec. Ord dec => Pat dec -> Pat dec -> Ordering
forall dec. Ord dec => Pat dec -> Pat dec -> Pat dec
$ccompare :: forall dec. Ord dec => Pat dec -> Pat dec -> Ordering
compare :: Pat dec -> Pat dec -> Ordering
$c< :: forall dec. Ord dec => Pat dec -> Pat dec -> Bool
< :: Pat dec -> Pat dec -> Bool
$c<= :: forall dec. Ord dec => Pat dec -> Pat dec -> Bool
<= :: Pat dec -> Pat dec -> Bool
$c> :: forall dec. Ord dec => Pat dec -> Pat dec -> Bool
> :: Pat dec -> Pat dec -> Bool
$c>= :: forall dec. Ord dec => Pat dec -> Pat dec -> Bool
>= :: Pat dec -> Pat dec -> Bool
$cmax :: forall dec. Ord dec => Pat dec -> Pat dec -> Pat dec
max :: Pat dec -> Pat dec -> Pat dec
$cmin :: forall dec. Ord dec => Pat dec -> Pat dec -> Pat dec
min :: Pat dec -> Pat dec -> Pat dec
Ord, Int -> Pat dec -> ShowS
[Pat dec] -> ShowS
Pat dec -> String
(Int -> Pat dec -> ShowS)
-> (Pat dec -> String) -> ([Pat dec] -> ShowS) -> Show (Pat dec)
forall dec. Show dec => Int -> Pat dec -> ShowS
forall dec. Show dec => [Pat dec] -> ShowS
forall dec. Show dec => Pat dec -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall dec. Show dec => Int -> Pat dec -> ShowS
showsPrec :: Int -> Pat dec -> ShowS
$cshow :: forall dec. Show dec => Pat dec -> String
show :: Pat dec -> String
$cshowList :: forall dec. Show dec => [Pat dec] -> ShowS
showList :: [Pat dec] -> ShowS
Show, Pat dec -> Pat dec -> Bool
(Pat dec -> Pat dec -> Bool)
-> (Pat dec -> Pat dec -> Bool) -> Eq (Pat dec)
forall dec. Eq dec => Pat dec -> Pat dec -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall dec. Eq dec => Pat dec -> Pat dec -> Bool
== :: Pat dec -> Pat dec -> Bool
$c/= :: forall dec. Eq dec => Pat dec -> Pat dec -> Bool
/= :: Pat dec -> Pat dec -> Bool
Eq)
instance Semigroup (Pat dec) where
Pat [PatElem dec]
xs <> :: Pat dec -> Pat dec -> Pat dec
<> Pat [PatElem dec]
ys = [PatElem dec] -> Pat dec
forall dec. [PatElem dec] -> Pat dec
Pat ([PatElem dec]
xs [PatElem dec] -> [PatElem dec] -> [PatElem dec]
forall a. Semigroup a => a -> a -> a
<> [PatElem dec]
ys)
instance Monoid (Pat dec) where
mempty :: Pat dec
mempty = [PatElem dec] -> Pat dec
forall dec. [PatElem dec] -> Pat dec
Pat [PatElem dec]
forall a. Monoid a => a
mempty
instance Functor Pat where
fmap :: forall a b. (a -> b) -> Pat a -> Pat b
fmap = (a -> b) -> Pat a -> Pat b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable Pat where
foldMap :: forall m a. Monoid m => (a -> m) -> Pat a -> m
foldMap = (a -> m) -> Pat a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable Pat where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Pat a -> f (Pat b)
traverse a -> f b
f (Pat [PatElem a]
xs) =
[PatElem b] -> Pat b
forall dec. [PatElem dec] -> Pat dec
Pat ([PatElem b] -> Pat b) -> f [PatElem b] -> f (Pat b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (PatElem a -> f (PatElem b)) -> [PatElem a] -> f [PatElem b]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse ((a -> f b) -> PatElem a -> f (PatElem b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> PatElem a -> f (PatElem b)
traverse a -> f b
f) [PatElem a]
xs
data StmAux dec = StmAux
{ forall dec. StmAux dec -> Certs
stmAuxCerts :: !Certs,
forall dec. StmAux dec -> Attrs
stmAuxAttrs :: Attrs,
forall dec. StmAux dec -> dec
stmAuxDec :: dec
}
deriving (Eq (StmAux dec)
Eq (StmAux dec) =>
(StmAux dec -> StmAux dec -> Ordering)
-> (StmAux dec -> StmAux dec -> Bool)
-> (StmAux dec -> StmAux dec -> Bool)
-> (StmAux dec -> StmAux dec -> Bool)
-> (StmAux dec -> StmAux dec -> Bool)
-> (StmAux dec -> StmAux dec -> StmAux dec)
-> (StmAux dec -> StmAux dec -> StmAux dec)
-> Ord (StmAux dec)
StmAux dec -> StmAux dec -> Bool
StmAux dec -> StmAux dec -> Ordering
StmAux dec -> StmAux dec -> StmAux dec
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
forall dec. Ord dec => Eq (StmAux dec)
forall dec. Ord dec => StmAux dec -> StmAux dec -> Bool
forall dec. Ord dec => StmAux dec -> StmAux dec -> Ordering
forall dec. Ord dec => StmAux dec -> StmAux dec -> StmAux dec
$ccompare :: forall dec. Ord dec => StmAux dec -> StmAux dec -> Ordering
compare :: StmAux dec -> StmAux dec -> Ordering
$c< :: forall dec. Ord dec => StmAux dec -> StmAux dec -> Bool
< :: StmAux dec -> StmAux dec -> Bool
$c<= :: forall dec. Ord dec => StmAux dec -> StmAux dec -> Bool
<= :: StmAux dec -> StmAux dec -> Bool
$c> :: forall dec. Ord dec => StmAux dec -> StmAux dec -> Bool
> :: StmAux dec -> StmAux dec -> Bool
$c>= :: forall dec. Ord dec => StmAux dec -> StmAux dec -> Bool
>= :: StmAux dec -> StmAux dec -> Bool
$cmax :: forall dec. Ord dec => StmAux dec -> StmAux dec -> StmAux dec
max :: StmAux dec -> StmAux dec -> StmAux dec
$cmin :: forall dec. Ord dec => StmAux dec -> StmAux dec -> StmAux dec
min :: StmAux dec -> StmAux dec -> StmAux dec
Ord, Int -> StmAux dec -> ShowS
[StmAux dec] -> ShowS
StmAux dec -> String
(Int -> StmAux dec -> ShowS)
-> (StmAux dec -> String)
-> ([StmAux dec] -> ShowS)
-> Show (StmAux dec)
forall dec. Show dec => Int -> StmAux dec -> ShowS
forall dec. Show dec => [StmAux dec] -> ShowS
forall dec. Show dec => StmAux dec -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall dec. Show dec => Int -> StmAux dec -> ShowS
showsPrec :: Int -> StmAux dec -> ShowS
$cshow :: forall dec. Show dec => StmAux dec -> String
show :: StmAux dec -> String
$cshowList :: forall dec. Show dec => [StmAux dec] -> ShowS
showList :: [StmAux dec] -> ShowS
Show, StmAux dec -> StmAux dec -> Bool
(StmAux dec -> StmAux dec -> Bool)
-> (StmAux dec -> StmAux dec -> Bool) -> Eq (StmAux dec)
forall dec. Eq dec => StmAux dec -> StmAux dec -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall dec. Eq dec => StmAux dec -> StmAux dec -> Bool
== :: StmAux dec -> StmAux dec -> Bool
$c/= :: forall dec. Eq dec => StmAux dec -> StmAux dec -> Bool
/= :: StmAux dec -> StmAux dec -> Bool
Eq)
instance (Semigroup dec) => Semigroup (StmAux dec) where
StmAux Certs
cs1 Attrs
attrs1 dec
dec1 <> :: StmAux dec -> StmAux dec -> StmAux dec
<> StmAux Certs
cs2 Attrs
attrs2 dec
dec2 =
Certs -> Attrs -> dec -> StmAux dec
forall dec. Certs -> Attrs -> dec -> StmAux dec
StmAux (Certs
cs1 Certs -> Certs -> Certs
forall a. Semigroup a => a -> a -> a
<> Certs
cs2) (Attrs
attrs1 Attrs -> Attrs -> Attrs
forall a. Semigroup a => a -> a -> a
<> Attrs
attrs2) (dec
dec1 dec -> dec -> dec
forall a. Semigroup a => a -> a -> a
<> dec
dec2)
data Stm rep = Let
{
forall rep. Stm rep -> Pat (LetDec rep)
stmPat :: Pat (LetDec rep),
forall rep. Stm rep -> StmAux (ExpDec rep)
stmAux :: StmAux (ExpDec rep),
forall rep. Stm rep -> Exp rep
stmExp :: Exp rep
}
deriving instance (RepTypes rep) => Ord (Stm rep)
deriving instance (RepTypes rep) => Show (Stm rep)
deriving instance (RepTypes rep) => Eq (Stm rep)
type Stms rep = Seq.Seq (Stm rep)
oneStm :: Stm rep -> Stms rep
oneStm :: forall rep. Stm rep -> Stms rep
oneStm = Stm rep -> Seq (Stm rep)
forall a. a -> Seq a
Seq.singleton
stmsFromList :: [Stm rep] -> Stms rep
stmsFromList :: forall rep. [Stm rep] -> Stms rep
stmsFromList = [Stm rep] -> Seq (Stm rep)
forall a. [a] -> Seq a
Seq.fromList
stmsToList :: Stms rep -> [Stm rep]
stmsToList :: forall rep. Stms rep -> [Stm rep]
stmsToList = Seq (Stm rep) -> [Stm rep]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList
stmsHead :: Stms rep -> Maybe (Stm rep, Stms rep)
stmsHead :: forall rep. Stms rep -> Maybe (Stm rep, Stms rep)
stmsHead Stms rep
stms = case Stms rep -> ViewL (Stm rep)
forall a. Seq a -> ViewL a
Seq.viewl Stms rep
stms of
Stm rep
stm Seq.:< Stms rep
stms' -> (Stm rep, Stms rep) -> Maybe (Stm rep, Stms rep)
forall a. a -> Maybe a
Just (Stm rep
stm, Stms rep
stms')
ViewL (Stm rep)
Seq.EmptyL -> Maybe (Stm rep, Stms rep)
forall a. Maybe a
Nothing
stmsLast :: Stms lore -> Maybe (Stms lore, Stm lore)
stmsLast :: forall lore. Stms lore -> Maybe (Stms lore, Stm lore)
stmsLast Stms lore
stms = case Stms lore -> ViewR (Stm lore)
forall a. Seq a -> ViewR a
Seq.viewr Stms lore
stms of
Stms lore
stms' Seq.:> Stm lore
stm -> (Stms lore, Stm lore) -> Maybe (Stms lore, Stm lore)
forall a. a -> Maybe a
Just (Stms lore
stms', Stm lore
stm)
ViewR (Stm lore)
Seq.EmptyR -> Maybe (Stms lore, Stm lore)
forall a. Maybe a
Nothing
data SubExpRes = SubExpRes
{ SubExpRes -> Certs
resCerts :: Certs,
SubExpRes -> SubExp
resSubExp :: SubExp
}
deriving (SubExpRes -> SubExpRes -> Bool
(SubExpRes -> SubExpRes -> Bool)
-> (SubExpRes -> SubExpRes -> Bool) -> Eq SubExpRes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubExpRes -> SubExpRes -> Bool
== :: SubExpRes -> SubExpRes -> Bool
$c/= :: SubExpRes -> SubExpRes -> Bool
/= :: SubExpRes -> SubExpRes -> Bool
Eq, Eq SubExpRes
Eq SubExpRes =>
(SubExpRes -> SubExpRes -> Ordering)
-> (SubExpRes -> SubExpRes -> Bool)
-> (SubExpRes -> SubExpRes -> Bool)
-> (SubExpRes -> SubExpRes -> Bool)
-> (SubExpRes -> SubExpRes -> Bool)
-> (SubExpRes -> SubExpRes -> SubExpRes)
-> (SubExpRes -> SubExpRes -> SubExpRes)
-> Ord SubExpRes
SubExpRes -> SubExpRes -> Bool
SubExpRes -> SubExpRes -> Ordering
SubExpRes -> SubExpRes -> SubExpRes
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
$ccompare :: SubExpRes -> SubExpRes -> Ordering
compare :: SubExpRes -> SubExpRes -> Ordering
$c< :: SubExpRes -> SubExpRes -> Bool
< :: SubExpRes -> SubExpRes -> Bool
$c<= :: SubExpRes -> SubExpRes -> Bool
<= :: SubExpRes -> SubExpRes -> Bool
$c> :: SubExpRes -> SubExpRes -> Bool
> :: SubExpRes -> SubExpRes -> Bool
$c>= :: SubExpRes -> SubExpRes -> Bool
>= :: SubExpRes -> SubExpRes -> Bool
$cmax :: SubExpRes -> SubExpRes -> SubExpRes
max :: SubExpRes -> SubExpRes -> SubExpRes
$cmin :: SubExpRes -> SubExpRes -> SubExpRes
min :: SubExpRes -> SubExpRes -> SubExpRes
Ord, Int -> SubExpRes -> ShowS
[SubExpRes] -> ShowS
SubExpRes -> String
(Int -> SubExpRes -> ShowS)
-> (SubExpRes -> String)
-> ([SubExpRes] -> ShowS)
-> Show SubExpRes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubExpRes -> ShowS
showsPrec :: Int -> SubExpRes -> ShowS
$cshow :: SubExpRes -> String
show :: SubExpRes -> String
$cshowList :: [SubExpRes] -> ShowS
showList :: [SubExpRes] -> ShowS
Show)
subExpRes :: SubExp -> SubExpRes
subExpRes :: SubExp -> SubExpRes
subExpRes = Certs -> SubExp -> SubExpRes
SubExpRes Certs
forall a. Monoid a => a
mempty
varRes :: VName -> SubExpRes
varRes :: VName -> SubExpRes
varRes = SubExp -> SubExpRes
subExpRes (SubExp -> SubExpRes) -> (VName -> SubExp) -> VName -> SubExpRes
forall b c a. (b -> c) -> (a -> b) -> a -> c
forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. VName -> SubExp
Var
subExpsRes :: [SubExp] -> Result
subExpsRes :: [SubExp] -> [SubExpRes]
subExpsRes = (SubExp -> SubExpRes) -> [SubExp] -> [SubExpRes]
forall a b. (a -> b) -> [a] -> [b]
map SubExp -> SubExpRes
subExpRes
varsRes :: [VName] -> Result
varsRes :: [VName] -> [SubExpRes]
varsRes = (VName -> SubExpRes) -> [VName] -> [SubExpRes]
forall a b. (a -> b) -> [a] -> [b]
map VName -> SubExpRes
varRes
subExpResVName :: SubExpRes -> Maybe VName
subExpResVName :: SubExpRes -> Maybe VName
subExpResVName (SubExpRes Certs
_ (Var VName
v)) = VName -> Maybe VName
forall a. a -> Maybe a
Just VName
v
subExpResVName SubExpRes
_ = Maybe VName
forall a. Maybe a
Nothing
type Result = [SubExpRes]
data Body rep = Body
{ forall rep. Body rep -> BodyDec rep
bodyDec :: BodyDec rep,
forall rep. Body rep -> Stms rep
bodyStms :: Stms rep,
forall rep. Body rep -> [SubExpRes]
bodyResult :: Result
}
deriving instance (RepTypes rep) => Ord (Body rep)
deriving instance (RepTypes rep) => Show (Body rep)
deriving instance (RepTypes rep) => Eq (Body rep)
data OpaqueOp
=
OpaqueNil
|
OpaqueTrace T.Text
deriving (OpaqueOp -> OpaqueOp -> Bool
(OpaqueOp -> OpaqueOp -> Bool)
-> (OpaqueOp -> OpaqueOp -> Bool) -> Eq OpaqueOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OpaqueOp -> OpaqueOp -> Bool
== :: OpaqueOp -> OpaqueOp -> Bool
$c/= :: OpaqueOp -> OpaqueOp -> Bool
/= :: OpaqueOp -> OpaqueOp -> Bool
Eq, Eq OpaqueOp
Eq OpaqueOp =>
(OpaqueOp -> OpaqueOp -> Ordering)
-> (OpaqueOp -> OpaqueOp -> Bool)
-> (OpaqueOp -> OpaqueOp -> Bool)
-> (OpaqueOp -> OpaqueOp -> Bool)
-> (OpaqueOp -> OpaqueOp -> Bool)
-> (OpaqueOp -> OpaqueOp -> OpaqueOp)
-> (OpaqueOp -> OpaqueOp -> OpaqueOp)
-> Ord OpaqueOp
OpaqueOp -> OpaqueOp -> Bool
OpaqueOp -> OpaqueOp -> Ordering
OpaqueOp -> OpaqueOp -> OpaqueOp
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
$ccompare :: OpaqueOp -> OpaqueOp -> Ordering
compare :: OpaqueOp -> OpaqueOp -> Ordering
$c< :: OpaqueOp -> OpaqueOp -> Bool
< :: OpaqueOp -> OpaqueOp -> Bool
$c<= :: OpaqueOp -> OpaqueOp -> Bool
<= :: OpaqueOp -> OpaqueOp -> Bool
$c> :: OpaqueOp -> OpaqueOp -> Bool
> :: OpaqueOp -> OpaqueOp -> Bool
$c>= :: OpaqueOp -> OpaqueOp -> Bool
>= :: OpaqueOp -> OpaqueOp -> Bool
$cmax :: OpaqueOp -> OpaqueOp -> OpaqueOp
max :: OpaqueOp -> OpaqueOp -> OpaqueOp
$cmin :: OpaqueOp -> OpaqueOp -> OpaqueOp
min :: OpaqueOp -> OpaqueOp -> OpaqueOp
Ord, Int -> OpaqueOp -> ShowS
[OpaqueOp] -> ShowS
OpaqueOp -> String
(Int -> OpaqueOp -> ShowS)
-> (OpaqueOp -> String) -> ([OpaqueOp] -> ShowS) -> Show OpaqueOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpaqueOp -> ShowS
showsPrec :: Int -> OpaqueOp -> ShowS
$cshow :: OpaqueOp -> String
show :: OpaqueOp -> String
$cshowList :: [OpaqueOp] -> ShowS
showList :: [OpaqueOp] -> ShowS
Show)
data ReshapeKind
=
ReshapeCoerce
|
ReshapeArbitrary
deriving (ReshapeKind -> ReshapeKind -> Bool
(ReshapeKind -> ReshapeKind -> Bool)
-> (ReshapeKind -> ReshapeKind -> Bool) -> Eq ReshapeKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReshapeKind -> ReshapeKind -> Bool
== :: ReshapeKind -> ReshapeKind -> Bool
$c/= :: ReshapeKind -> ReshapeKind -> Bool
/= :: ReshapeKind -> ReshapeKind -> Bool
Eq, Eq ReshapeKind
Eq ReshapeKind =>
(ReshapeKind -> ReshapeKind -> Ordering)
-> (ReshapeKind -> ReshapeKind -> Bool)
-> (ReshapeKind -> ReshapeKind -> Bool)
-> (ReshapeKind -> ReshapeKind -> Bool)
-> (ReshapeKind -> ReshapeKind -> Bool)
-> (ReshapeKind -> ReshapeKind -> ReshapeKind)
-> (ReshapeKind -> ReshapeKind -> ReshapeKind)
-> Ord ReshapeKind
ReshapeKind -> ReshapeKind -> Bool
ReshapeKind -> ReshapeKind -> Ordering
ReshapeKind -> ReshapeKind -> ReshapeKind
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
$ccompare :: ReshapeKind -> ReshapeKind -> Ordering
compare :: ReshapeKind -> ReshapeKind -> Ordering
$c< :: ReshapeKind -> ReshapeKind -> Bool
< :: ReshapeKind -> ReshapeKind -> Bool
$c<= :: ReshapeKind -> ReshapeKind -> Bool
<= :: ReshapeKind -> ReshapeKind -> Bool
$c> :: ReshapeKind -> ReshapeKind -> Bool
> :: ReshapeKind -> ReshapeKind -> Bool
$c>= :: ReshapeKind -> ReshapeKind -> Bool
>= :: ReshapeKind -> ReshapeKind -> Bool
$cmax :: ReshapeKind -> ReshapeKind -> ReshapeKind
max :: ReshapeKind -> ReshapeKind -> ReshapeKind
$cmin :: ReshapeKind -> ReshapeKind -> ReshapeKind
min :: ReshapeKind -> ReshapeKind -> ReshapeKind
Ord, Int -> ReshapeKind -> ShowS
[ReshapeKind] -> ShowS
ReshapeKind -> String
(Int -> ReshapeKind -> ShowS)
-> (ReshapeKind -> String)
-> ([ReshapeKind] -> ShowS)
-> Show ReshapeKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReshapeKind -> ShowS
showsPrec :: Int -> ReshapeKind -> ShowS
$cshow :: ReshapeKind -> String
show :: ReshapeKind -> String
$cshowList :: [ReshapeKind] -> ShowS
showList :: [ReshapeKind] -> ShowS
Show)
data BasicOp
=
SubExp SubExp
|
Opaque OpaqueOp SubExp
|
ArrayLit [SubExp] Type
|
ArrayVal [PrimValue] PrimType
|
UnOp UnOp SubExp
|
BinOp BinOp SubExp SubExp
|
CmpOp CmpOp SubExp SubExp
|
ConvOp ConvOp SubExp
|
Assert SubExp (ErrorMsg SubExp) (SrcLoc, [SrcLoc])
|
Index VName (Slice SubExp)
|
Update Safety VName (Slice SubExp) SubExp
| FlatIndex VName (FlatSlice SubExp)
| FlatUpdate VName (FlatSlice SubExp) VName
|
Concat Int (NonEmpty VName) SubExp
|
Manifest [Int] VName
|
Iota SubExp SubExp SubExp IntType
|
Replicate Shape SubExp
|
Scratch PrimType [SubExp]
|
Reshape ReshapeKind Shape VName
|
Rearrange [Int] VName
|
UpdateAcc Safety VName [SubExp] [SubExp]
deriving (BasicOp -> BasicOp -> Bool
(BasicOp -> BasicOp -> Bool)
-> (BasicOp -> BasicOp -> Bool) -> Eq BasicOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BasicOp -> BasicOp -> Bool
== :: BasicOp -> BasicOp -> Bool
$c/= :: BasicOp -> BasicOp -> Bool
/= :: BasicOp -> BasicOp -> Bool
Eq, Eq BasicOp
Eq BasicOp =>
(BasicOp -> BasicOp -> Ordering)
-> (BasicOp -> BasicOp -> Bool)
-> (BasicOp -> BasicOp -> Bool)
-> (BasicOp -> BasicOp -> Bool)
-> (BasicOp -> BasicOp -> Bool)
-> (BasicOp -> BasicOp -> BasicOp)
-> (BasicOp -> BasicOp -> BasicOp)
-> Ord BasicOp
BasicOp -> BasicOp -> Bool
BasicOp -> BasicOp -> Ordering
BasicOp -> BasicOp -> BasicOp
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
$ccompare :: BasicOp -> BasicOp -> Ordering
compare :: BasicOp -> BasicOp -> Ordering
$c< :: BasicOp -> BasicOp -> Bool
< :: BasicOp -> BasicOp -> Bool
$c<= :: BasicOp -> BasicOp -> Bool
<= :: BasicOp -> BasicOp -> Bool
$c> :: BasicOp -> BasicOp -> Bool
> :: BasicOp -> BasicOp -> Bool
$c>= :: BasicOp -> BasicOp -> Bool
>= :: BasicOp -> BasicOp -> Bool
$cmax :: BasicOp -> BasicOp -> BasicOp
max :: BasicOp -> BasicOp -> BasicOp
$cmin :: BasicOp -> BasicOp -> BasicOp
min :: BasicOp -> BasicOp -> BasicOp
Ord, Int -> BasicOp -> ShowS
[BasicOp] -> ShowS
BasicOp -> String
(Int -> BasicOp -> ShowS)
-> (BasicOp -> String) -> ([BasicOp] -> ShowS) -> Show BasicOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BasicOp -> ShowS
showsPrec :: Int -> BasicOp -> ShowS
$cshow :: BasicOp -> String
show :: BasicOp -> String
$cshowList :: [BasicOp] -> ShowS
showList :: [BasicOp] -> ShowS
Show)
type WithAccInput rep =
(Shape, [VName], Maybe (Lambda rep, [SubExp]))
data Case body = Case {forall body. Case body -> [Maybe PrimValue]
casePat :: [Maybe PrimValue], forall body. Case body -> body
caseBody :: body}
deriving (Case body -> Case body -> Bool
(Case body -> Case body -> Bool)
-> (Case body -> Case body -> Bool) -> Eq (Case body)
forall body. Eq body => Case body -> Case body -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall body. Eq body => Case body -> Case body -> Bool
== :: Case body -> Case body -> Bool
$c/= :: forall body. Eq body => Case body -> Case body -> Bool
/= :: Case body -> Case body -> Bool
Eq, Eq (Case body)
Eq (Case body) =>
(Case body -> Case body -> Ordering)
-> (Case body -> Case body -> Bool)
-> (Case body -> Case body -> Bool)
-> (Case body -> Case body -> Bool)
-> (Case body -> Case body -> Bool)
-> (Case body -> Case body -> Case body)
-> (Case body -> Case body -> Case body)
-> Ord (Case body)
Case body -> Case body -> Bool
Case body -> Case body -> Ordering
Case body -> Case body -> Case body
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
forall body. Ord body => Eq (Case body)
forall body. Ord body => Case body -> Case body -> Bool
forall body. Ord body => Case body -> Case body -> Ordering
forall body. Ord body => Case body -> Case body -> Case body
$ccompare :: forall body. Ord body => Case body -> Case body -> Ordering
compare :: Case body -> Case body -> Ordering
$c< :: forall body. Ord body => Case body -> Case body -> Bool
< :: Case body -> Case body -> Bool
$c<= :: forall body. Ord body => Case body -> Case body -> Bool
<= :: Case body -> Case body -> Bool
$c> :: forall body. Ord body => Case body -> Case body -> Bool
> :: Case body -> Case body -> Bool
$c>= :: forall body. Ord body => Case body -> Case body -> Bool
>= :: Case body -> Case body -> Bool
$cmax :: forall body. Ord body => Case body -> Case body -> Case body
max :: Case body -> Case body -> Case body
$cmin :: forall body. Ord body => Case body -> Case body -> Case body
min :: Case body -> Case body -> Case body
Ord, Int -> Case body -> ShowS
[Case body] -> ShowS
Case body -> String
(Int -> Case body -> ShowS)
-> (Case body -> String)
-> ([Case body] -> ShowS)
-> Show (Case body)
forall body. Show body => Int -> Case body -> ShowS
forall body. Show body => [Case body] -> ShowS
forall body. Show body => Case body -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall body. Show body => Int -> Case body -> ShowS
showsPrec :: Int -> Case body -> ShowS
$cshow :: forall body. Show body => Case body -> String
show :: Case body -> String
$cshowList :: forall body. Show body => [Case body] -> ShowS
showList :: [Case body] -> ShowS
Show)
instance Functor Case where
fmap :: forall a b. (a -> b) -> Case a -> Case b
fmap = (a -> b) -> Case a -> Case b
forall (t :: * -> *) a b. Traversable t => (a -> b) -> t a -> t b
fmapDefault
instance Foldable Case where
foldMap :: forall m a. Monoid m => (a -> m) -> Case a -> m
foldMap = (a -> m) -> Case a -> m
forall (t :: * -> *) m a.
(Traversable t, Monoid m) =>
(a -> m) -> t a -> m
foldMapDefault
instance Traversable Case where
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Case a -> f (Case b)
traverse a -> f b
f (Case [Maybe PrimValue]
vs a
b) = [Maybe PrimValue] -> b -> Case b
forall body. [Maybe PrimValue] -> body -> Case body
Case [Maybe PrimValue]
vs (b -> Case b) -> f b -> f (Case b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
b
data RetAls = RetAls
{
RetAls -> [Int]
paramAls :: [Int],
RetAls -> [Int]
otherAls :: [Int]
}
deriving (RetAls -> RetAls -> Bool
(RetAls -> RetAls -> Bool)
-> (RetAls -> RetAls -> Bool) -> Eq RetAls
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RetAls -> RetAls -> Bool
== :: RetAls -> RetAls -> Bool
$c/= :: RetAls -> RetAls -> Bool
/= :: RetAls -> RetAls -> Bool
Eq, Eq RetAls
Eq RetAls =>
(RetAls -> RetAls -> Ordering)
-> (RetAls -> RetAls -> Bool)
-> (RetAls -> RetAls -> Bool)
-> (RetAls -> RetAls -> Bool)
-> (RetAls -> RetAls -> Bool)
-> (RetAls -> RetAls -> RetAls)
-> (RetAls -> RetAls -> RetAls)
-> Ord RetAls
RetAls -> RetAls -> Bool
RetAls -> RetAls -> Ordering
RetAls -> RetAls -> RetAls
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
$ccompare :: RetAls -> RetAls -> Ordering
compare :: RetAls -> RetAls -> Ordering
$c< :: RetAls -> RetAls -> Bool
< :: RetAls -> RetAls -> Bool
$c<= :: RetAls -> RetAls -> Bool
<= :: RetAls -> RetAls -> Bool
$c> :: RetAls -> RetAls -> Bool
> :: RetAls -> RetAls -> Bool
$c>= :: RetAls -> RetAls -> Bool
>= :: RetAls -> RetAls -> Bool
$cmax :: RetAls -> RetAls -> RetAls
max :: RetAls -> RetAls -> RetAls
$cmin :: RetAls -> RetAls -> RetAls
min :: RetAls -> RetAls -> RetAls
Ord, Int -> RetAls -> ShowS
[RetAls] -> ShowS
RetAls -> String
(Int -> RetAls -> ShowS)
-> (RetAls -> String) -> ([RetAls] -> ShowS) -> Show RetAls
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RetAls -> ShowS
showsPrec :: Int -> RetAls -> ShowS
$cshow :: RetAls -> String
show :: RetAls -> String
$cshowList :: [RetAls] -> ShowS
showList :: [RetAls] -> ShowS
Show)
instance Monoid RetAls where
mempty :: RetAls
mempty = [Int] -> [Int] -> RetAls
RetAls [Int]
forall a. Monoid a => a
mempty [Int]
forall a. Monoid a => a
mempty
instance Semigroup RetAls where
RetAls [Int]
pals1 [Int]
rals1 <> :: RetAls -> RetAls -> RetAls
<> RetAls [Int]
pals2 [Int]
rals2 =
[Int] -> [Int] -> RetAls
RetAls ([Int]
pals1 [Int] -> [Int] -> [Int]
forall a. Semigroup a => a -> a -> a
<> [Int]
pals2) ([Int]
rals1 [Int] -> [Int] -> [Int]
forall a. Semigroup a => a -> a -> a
<> [Int]
rals2)
data Exp rep
=
BasicOp BasicOp
| Apply Name [(SubExp, Diet)] [(RetType rep, RetAls)] (Safety, SrcLoc, [SrcLoc])
|
Match [SubExp] [Case (Body rep)] (Body rep) (MatchDec (BranchType rep))
|
Loop [(FParam rep, SubExp)] LoopForm (Body rep)
|
WithAcc [WithAccInput rep] (Lambda rep)
| Op (Op rep)
deriving instance (RepTypes rep) => Eq (Exp rep)
deriving instance (RepTypes rep) => Show (Exp rep)
deriving instance (RepTypes rep) => Ord (Exp rep)
data LoopForm
= ForLoop
VName
IntType
SubExp
| WhileLoop VName
deriving (LoopForm -> LoopForm -> Bool
(LoopForm -> LoopForm -> Bool)
-> (LoopForm -> LoopForm -> Bool) -> Eq LoopForm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LoopForm -> LoopForm -> Bool
== :: LoopForm -> LoopForm -> Bool
$c/= :: LoopForm -> LoopForm -> Bool
/= :: LoopForm -> LoopForm -> Bool
Eq, Eq LoopForm
Eq LoopForm =>
(LoopForm -> LoopForm -> Ordering)
-> (LoopForm -> LoopForm -> Bool)
-> (LoopForm -> LoopForm -> Bool)
-> (LoopForm -> LoopForm -> Bool)
-> (LoopForm -> LoopForm -> Bool)
-> (LoopForm -> LoopForm -> LoopForm)
-> (LoopForm -> LoopForm -> LoopForm)
-> Ord LoopForm
LoopForm -> LoopForm -> Bool
LoopForm -> LoopForm -> Ordering
LoopForm -> LoopForm -> LoopForm
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
$ccompare :: LoopForm -> LoopForm -> Ordering
compare :: LoopForm -> LoopForm -> Ordering
$c< :: LoopForm -> LoopForm -> Bool
< :: LoopForm -> LoopForm -> Bool
$c<= :: LoopForm -> LoopForm -> Bool
<= :: LoopForm -> LoopForm -> Bool
$c> :: LoopForm -> LoopForm -> Bool
> :: LoopForm -> LoopForm -> Bool
$c>= :: LoopForm -> LoopForm -> Bool
>= :: LoopForm -> LoopForm -> Bool
$cmax :: LoopForm -> LoopForm -> LoopForm
max :: LoopForm -> LoopForm -> LoopForm
$cmin :: LoopForm -> LoopForm -> LoopForm
min :: LoopForm -> LoopForm -> LoopForm
Ord, Int -> LoopForm -> ShowS
[LoopForm] -> ShowS
LoopForm -> String
(Int -> LoopForm -> ShowS)
-> (LoopForm -> String) -> ([LoopForm] -> ShowS) -> Show LoopForm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LoopForm -> ShowS
showsPrec :: Int -> LoopForm -> ShowS
$cshow :: LoopForm -> String
show :: LoopForm -> String
$cshowList :: [LoopForm] -> ShowS
showList :: [LoopForm] -> ShowS
Show)
data MatchDec rt = MatchDec
{ forall rt. MatchDec rt -> [rt]
matchReturns :: [rt],
forall rt. MatchDec rt -> MatchSort
matchSort :: MatchSort
}
deriving (MatchDec rt -> MatchDec rt -> Bool
(MatchDec rt -> MatchDec rt -> Bool)
-> (MatchDec rt -> MatchDec rt -> Bool) -> Eq (MatchDec rt)
forall rt. Eq rt => MatchDec rt -> MatchDec rt -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall rt. Eq rt => MatchDec rt -> MatchDec rt -> Bool
== :: MatchDec rt -> MatchDec rt -> Bool
$c/= :: forall rt. Eq rt => MatchDec rt -> MatchDec rt -> Bool
/= :: MatchDec rt -> MatchDec rt -> Bool
Eq, Int -> MatchDec rt -> ShowS
[MatchDec rt] -> ShowS
MatchDec rt -> String
(Int -> MatchDec rt -> ShowS)
-> (MatchDec rt -> String)
-> ([MatchDec rt] -> ShowS)
-> Show (MatchDec rt)
forall rt. Show rt => Int -> MatchDec rt -> ShowS
forall rt. Show rt => [MatchDec rt] -> ShowS
forall rt. Show rt => MatchDec rt -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall rt. Show rt => Int -> MatchDec rt -> ShowS
showsPrec :: Int -> MatchDec rt -> ShowS
$cshow :: forall rt. Show rt => MatchDec rt -> String
show :: MatchDec rt -> String
$cshowList :: forall rt. Show rt => [MatchDec rt] -> ShowS
showList :: [MatchDec rt] -> ShowS
Show, Eq (MatchDec rt)
Eq (MatchDec rt) =>
(MatchDec rt -> MatchDec rt -> Ordering)
-> (MatchDec rt -> MatchDec rt -> Bool)
-> (MatchDec rt -> MatchDec rt -> Bool)
-> (MatchDec rt -> MatchDec rt -> Bool)
-> (MatchDec rt -> MatchDec rt -> Bool)
-> (MatchDec rt -> MatchDec rt -> MatchDec rt)
-> (MatchDec rt -> MatchDec rt -> MatchDec rt)
-> Ord (MatchDec rt)
MatchDec rt -> MatchDec rt -> Bool
MatchDec rt -> MatchDec rt -> Ordering
MatchDec rt -> MatchDec rt -> MatchDec rt
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
forall rt. Ord rt => Eq (MatchDec rt)
forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Bool
forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Ordering
forall rt. Ord rt => MatchDec rt -> MatchDec rt -> MatchDec rt
$ccompare :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Ordering
compare :: MatchDec rt -> MatchDec rt -> Ordering
$c< :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Bool
< :: MatchDec rt -> MatchDec rt -> Bool
$c<= :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Bool
<= :: MatchDec rt -> MatchDec rt -> Bool
$c> :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Bool
> :: MatchDec rt -> MatchDec rt -> Bool
$c>= :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> Bool
>= :: MatchDec rt -> MatchDec rt -> Bool
$cmax :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> MatchDec rt
max :: MatchDec rt -> MatchDec rt -> MatchDec rt
$cmin :: forall rt. Ord rt => MatchDec rt -> MatchDec rt -> MatchDec rt
min :: MatchDec rt -> MatchDec rt -> MatchDec rt
Ord)
data MatchSort
=
MatchNormal
|
MatchFallback
|
MatchEquiv
deriving (MatchSort -> MatchSort -> Bool
(MatchSort -> MatchSort -> Bool)
-> (MatchSort -> MatchSort -> Bool) -> Eq MatchSort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MatchSort -> MatchSort -> Bool
== :: MatchSort -> MatchSort -> Bool
$c/= :: MatchSort -> MatchSort -> Bool
/= :: MatchSort -> MatchSort -> Bool
Eq, Int -> MatchSort -> ShowS
[MatchSort] -> ShowS
MatchSort -> String
(Int -> MatchSort -> ShowS)
-> (MatchSort -> String)
-> ([MatchSort] -> ShowS)
-> Show MatchSort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MatchSort -> ShowS
showsPrec :: Int -> MatchSort -> ShowS
$cshow :: MatchSort -> String
show :: MatchSort -> String
$cshowList :: [MatchSort] -> ShowS
showList :: [MatchSort] -> ShowS
Show, Eq MatchSort
Eq MatchSort =>
(MatchSort -> MatchSort -> Ordering)
-> (MatchSort -> MatchSort -> Bool)
-> (MatchSort -> MatchSort -> Bool)
-> (MatchSort -> MatchSort -> Bool)
-> (MatchSort -> MatchSort -> Bool)
-> (MatchSort -> MatchSort -> MatchSort)
-> (MatchSort -> MatchSort -> MatchSort)
-> Ord MatchSort
MatchSort -> MatchSort -> Bool
MatchSort -> MatchSort -> Ordering
MatchSort -> MatchSort -> MatchSort
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
$ccompare :: MatchSort -> MatchSort -> Ordering
compare :: MatchSort -> MatchSort -> Ordering
$c< :: MatchSort -> MatchSort -> Bool
< :: MatchSort -> MatchSort -> Bool
$c<= :: MatchSort -> MatchSort -> Bool
<= :: MatchSort -> MatchSort -> Bool
$c> :: MatchSort -> MatchSort -> Bool
> :: MatchSort -> MatchSort -> Bool
$c>= :: MatchSort -> MatchSort -> Bool
>= :: MatchSort -> MatchSort -> Bool
$cmax :: MatchSort -> MatchSort -> MatchSort
max :: MatchSort -> MatchSort -> MatchSort
$cmin :: MatchSort -> MatchSort -> MatchSort
min :: MatchSort -> MatchSort -> MatchSort
Ord)
data Lambda rep = Lambda
{ forall rep. Lambda rep -> [LParam rep]
lambdaParams :: [LParam rep],
forall rep. Lambda rep -> [Type]
lambdaReturnType :: [Type],
forall rep. Lambda rep -> Body rep
lambdaBody :: Body rep
}
deriving instance (RepTypes rep) => Eq (Lambda rep)
deriving instance (RepTypes rep) => Show (Lambda rep)
deriving instance (RepTypes rep) => Ord (Lambda rep)
type FParam rep = Param (FParamInfo rep)
type LParam rep = Param (LParamInfo rep)
data FunDef rep = FunDef
{
forall rep. FunDef rep -> Maybe EntryPoint
funDefEntryPoint :: Maybe EntryPoint,
forall rep. FunDef rep -> Attrs
funDefAttrs :: Attrs,
forall rep. FunDef rep -> Name
funDefName :: Name,
forall rep. FunDef rep -> [(RetType rep, RetAls)]
funDefRetType :: [(RetType rep, RetAls)],
forall rep. FunDef rep -> [FParam rep]
funDefParams :: [FParam rep],
forall rep. FunDef rep -> Body rep
funDefBody :: Body rep
}
deriving instance (RepTypes rep) => Eq (FunDef rep)
deriving instance (RepTypes rep) => Show (FunDef rep)
deriving instance (RepTypes rep) => Ord (FunDef rep)
data EntryParam = EntryParam
{ EntryParam -> Name
entryParamName :: Name,
EntryParam -> Uniqueness
entryParamUniqueness :: Uniqueness,
EntryParam -> EntryPointType
entryParamType :: EntryPointType
}
deriving (EntryParam -> EntryParam -> Bool
(EntryParam -> EntryParam -> Bool)
-> (EntryParam -> EntryParam -> Bool) -> Eq EntryParam
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EntryParam -> EntryParam -> Bool
== :: EntryParam -> EntryParam -> Bool
$c/= :: EntryParam -> EntryParam -> Bool
/= :: EntryParam -> EntryParam -> Bool
Eq, Int -> EntryParam -> ShowS
[EntryParam] -> ShowS
EntryParam -> String
(Int -> EntryParam -> ShowS)
-> (EntryParam -> String)
-> ([EntryParam] -> ShowS)
-> Show EntryParam
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EntryParam -> ShowS
showsPrec :: Int -> EntryParam -> ShowS
$cshow :: EntryParam -> String
show :: EntryParam -> String
$cshowList :: [EntryParam] -> ShowS
showList :: [EntryParam] -> ShowS
Show, Eq EntryParam
Eq EntryParam =>
(EntryParam -> EntryParam -> Ordering)
-> (EntryParam -> EntryParam -> Bool)
-> (EntryParam -> EntryParam -> Bool)
-> (EntryParam -> EntryParam -> Bool)
-> (EntryParam -> EntryParam -> Bool)
-> (EntryParam -> EntryParam -> EntryParam)
-> (EntryParam -> EntryParam -> EntryParam)
-> Ord EntryParam
EntryParam -> EntryParam -> Bool
EntryParam -> EntryParam -> Ordering
EntryParam -> EntryParam -> EntryParam
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
$ccompare :: EntryParam -> EntryParam -> Ordering
compare :: EntryParam -> EntryParam -> Ordering
$c< :: EntryParam -> EntryParam -> Bool
< :: EntryParam -> EntryParam -> Bool
$c<= :: EntryParam -> EntryParam -> Bool
<= :: EntryParam -> EntryParam -> Bool
$c> :: EntryParam -> EntryParam -> Bool
> :: EntryParam -> EntryParam -> Bool
$c>= :: EntryParam -> EntryParam -> Bool
>= :: EntryParam -> EntryParam -> Bool
$cmax :: EntryParam -> EntryParam -> EntryParam
max :: EntryParam -> EntryParam -> EntryParam
$cmin :: EntryParam -> EntryParam -> EntryParam
min :: EntryParam -> EntryParam -> EntryParam
Ord)
data EntryResult = EntryResult
{ EntryResult -> Uniqueness
entryResultUniqueness :: Uniqueness,
EntryResult -> EntryPointType
entryResultType :: EntryPointType
}
deriving (EntryResult -> EntryResult -> Bool
(EntryResult -> EntryResult -> Bool)
-> (EntryResult -> EntryResult -> Bool) -> Eq EntryResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EntryResult -> EntryResult -> Bool
== :: EntryResult -> EntryResult -> Bool
$c/= :: EntryResult -> EntryResult -> Bool
/= :: EntryResult -> EntryResult -> Bool
Eq, Int -> EntryResult -> ShowS
[EntryResult] -> ShowS
EntryResult -> String
(Int -> EntryResult -> ShowS)
-> (EntryResult -> String)
-> ([EntryResult] -> ShowS)
-> Show EntryResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EntryResult -> ShowS
showsPrec :: Int -> EntryResult -> ShowS
$cshow :: EntryResult -> String
show :: EntryResult -> String
$cshowList :: [EntryResult] -> ShowS
showList :: [EntryResult] -> ShowS
Show, Eq EntryResult
Eq EntryResult =>
(EntryResult -> EntryResult -> Ordering)
-> (EntryResult -> EntryResult -> Bool)
-> (EntryResult -> EntryResult -> Bool)
-> (EntryResult -> EntryResult -> Bool)
-> (EntryResult -> EntryResult -> Bool)
-> (EntryResult -> EntryResult -> EntryResult)
-> (EntryResult -> EntryResult -> EntryResult)
-> Ord EntryResult
EntryResult -> EntryResult -> Bool
EntryResult -> EntryResult -> Ordering
EntryResult -> EntryResult -> EntryResult
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
$ccompare :: EntryResult -> EntryResult -> Ordering
compare :: EntryResult -> EntryResult -> Ordering
$c< :: EntryResult -> EntryResult -> Bool
< :: EntryResult -> EntryResult -> Bool
$c<= :: EntryResult -> EntryResult -> Bool
<= :: EntryResult -> EntryResult -> Bool
$c> :: EntryResult -> EntryResult -> Bool
> :: EntryResult -> EntryResult -> Bool
$c>= :: EntryResult -> EntryResult -> Bool
>= :: EntryResult -> EntryResult -> Bool
$cmax :: EntryResult -> EntryResult -> EntryResult
max :: EntryResult -> EntryResult -> EntryResult
$cmin :: EntryResult -> EntryResult -> EntryResult
min :: EntryResult -> EntryResult -> EntryResult
Ord)
type EntryPoint = (Name, [EntryParam], [EntryResult])
data Prog rep = Prog
{
forall rep. Prog rep -> OpaqueTypes
progTypes :: OpaqueTypes,
forall rep. Prog rep -> Stms rep
progConsts :: Stms rep,
forall rep. Prog rep -> [FunDef rep]
progFuns :: [FunDef rep]
}
deriving (Prog rep -> Prog rep -> Bool
(Prog rep -> Prog rep -> Bool)
-> (Prog rep -> Prog rep -> Bool) -> Eq (Prog rep)
forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
== :: Prog rep -> Prog rep -> Bool
$c/= :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
/= :: Prog rep -> Prog rep -> Bool
Eq, Eq (Prog rep)
Eq (Prog rep) =>
(Prog rep -> Prog rep -> Ordering)
-> (Prog rep -> Prog rep -> Bool)
-> (Prog rep -> Prog rep -> Bool)
-> (Prog rep -> Prog rep -> Bool)
-> (Prog rep -> Prog rep -> Bool)
-> (Prog rep -> Prog rep -> Prog rep)
-> (Prog rep -> Prog rep -> Prog rep)
-> Ord (Prog rep)
Prog rep -> Prog rep -> Bool
Prog rep -> Prog rep -> Ordering
Prog rep -> Prog rep -> Prog rep
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
forall rep. RepTypes rep => Eq (Prog rep)
forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
forall rep. RepTypes rep => Prog rep -> Prog rep -> Ordering
forall rep. RepTypes rep => Prog rep -> Prog rep -> Prog rep
$ccompare :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Ordering
compare :: Prog rep -> Prog rep -> Ordering
$c< :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
< :: Prog rep -> Prog rep -> Bool
$c<= :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
<= :: Prog rep -> Prog rep -> Bool
$c> :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
> :: Prog rep -> Prog rep -> Bool
$c>= :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Bool
>= :: Prog rep -> Prog rep -> Bool
$cmax :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Prog rep
max :: Prog rep -> Prog rep -> Prog rep
$cmin :: forall rep. RepTypes rep => Prog rep -> Prog rep -> Prog rep
min :: Prog rep -> Prog rep -> Prog rep
Ord, Int -> Prog rep -> ShowS
[Prog rep] -> ShowS
Prog rep -> String
(Int -> Prog rep -> ShowS)
-> (Prog rep -> String) -> ([Prog rep] -> ShowS) -> Show (Prog rep)
forall rep. RepTypes rep => Int -> Prog rep -> ShowS
forall rep. RepTypes rep => [Prog rep] -> ShowS
forall rep. RepTypes rep => Prog rep -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall rep. RepTypes rep => Int -> Prog rep -> ShowS
showsPrec :: Int -> Prog rep -> ShowS
$cshow :: forall rep. RepTypes rep => Prog rep -> String
show :: Prog rep -> String
$cshowList :: forall rep. RepTypes rep => [Prog rep] -> ShowS
showList :: [Prog rep] -> ShowS
Show)