Skip to content

Commit

Permalink
Add additional instances for AST types
Browse files Browse the repository at this point in the history
  • Loading branch information
mbg committed Dec 16, 2021
1 parent 9c07267 commit bb8cc93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/PlutusCore/TermF.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}

-- | Modular representations of the PLC abstract syntax.
module PlutusCore.TermF (
Expand Down Expand Up @@ -44,6 +44,7 @@ data DefaultConstantF r
| UnitConst
| ListConst [r]
| PairConst r r
deriving (Eq, Show, Functor, Foldable, Traversable)

type DefaultConstant = Fix DefaultConstantF

Expand Down Expand Up @@ -84,15 +85,15 @@ data TermF name const ann r
| Constant !ann !const
| Builtin !ann !DefaultFun
| Error !ann
deriving (Eq, Show, Functor)
deriving (Eq, Show, Functor, Foldable, Traversable)

-------------------------------------------------------------------------------

-- | Represents terms exclusive to Untyped Plutus Core.
data UntypedF ann r
= Force !ann !r
| Delay !ann !r
deriving (Eq, Show, Functor)
deriving (Eq, Show, Functor, Foldable, Traversable)

-- | Represents terms of Untyped Plutus Core.
type UntypedTermF name const ann = Sum (TermF name const ann) (UntypedF ann)
Expand Down Expand Up @@ -122,7 +123,7 @@ data TypedF tyname ann r
| TyInst ann r (PLC.Type tyname DefaultUni ann)
| Unwrap ann r
| IWrap ann (PLC.Type tyname DefaultUni ann) (PLC.Type tyname DefaultUni ann) r
deriving (Show, Functor)
deriving (Show, Functor, Foldable, Traversable)

-- | Represents terms of Typed Plutus Core.
type TypedTermF tyname name const ann =
Expand Down

0 comments on commit bb8cc93

Please sign in to comment.