-- editorconfig-checker-disable-file
-- | This module defines generators for PIR syntax trees for testing purposes.
-- It should only contain those generators that can't be reused from PLC
-- (PIR-exclusive constructs, Term, and Program)
{-# LANGUAGE OverloadedStrings #-}
module PlutusIR.Generators.AST
    ( module Export
    , discardIfAnyConstant
    , genProgram
    , genTerm
    , genBinding
    , genDatatype
    , genTyVarDecl
    , genVarDecl
    , genRecursivity
    ) where

import PlutusIR
import PlutusIR.Core.Plated

import PlutusCore.Default qualified as PLC
import PlutusCore.Generators.Hedgehog.AST as Export (AstGen, genBuiltin, genConstant, genKind,
                                                     genVersion, runAstGen, simpleRecursive)
import PlutusCore.Generators.Hedgehog.AST qualified as PLC

import Control.Lens (andOf, to)
import Hedgehog hiding (Rec, Var)
import Hedgehog.Gen qualified as Gen
import Hedgehog.Range qualified as Range
import Universe

discardIfAnyConstant
  :: MonadGen m
  => (Some (ValueOf uni) -> Bool)
  -> m (Program tyname name uni fun ann)
  -> m (Program tyname name uni fun ann)
discardIfAnyConstant :: forall (m :: * -> *) (uni :: * -> *) tyname name fun ann.
MonadGen m =>
(Some (ValueOf uni) -> Bool)
-> m (Program tyname name uni fun ann)
-> m (Program tyname name uni fun ann)
discardIfAnyConstant Some (ValueOf uni) -> Bool
p = (Program tyname name uni fun ann -> Bool)
-> m (Program tyname name uni fun ann)
-> m (Program tyname name uni fun ann)
forall (m :: * -> *) a. MonadGen m => (a -> Bool) -> m a -> m a
Gen.filterT ((Program tyname name uni fun ann -> Bool)
 -> m (Program tyname name uni fun ann)
 -> m (Program tyname name uni fun ann))
-> (Getting All (Program tyname name uni fun ann) Bool
    -> Program tyname name uni fun ann -> Bool)
-> Getting All (Program tyname name uni fun ann) Bool
-> m (Program tyname name uni fun ann)
-> m (Program tyname name uni fun ann)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting All (Program tyname name uni fun ann) Bool
-> Program tyname name uni fun ann -> Bool
forall s. Getting All s Bool -> s -> Bool
andOf (Getting All (Program tyname name uni fun ann) Bool
 -> m (Program tyname name uni fun ann)
 -> m (Program tyname name uni fun ann))
-> Getting All (Program tyname name uni fun ann) Bool
-> m (Program tyname name uni fun ann)
-> m (Program tyname name uni fun ann)
forall a b. (a -> b) -> a -> b
$ (Term tyname name uni fun ann
 -> Const All (Term tyname name uni fun ann))
-> Program tyname name uni fun ann
-> Const All (Program tyname name uni fun ann)
forall tyname1 name1 (uni1 :: * -> *) fun1 ann tyname2 name2
       (uni2 :: * -> *) fun2 (f :: * -> *).
Functor f =>
(Term tyname1 name1 uni1 fun1 ann
 -> f (Term tyname2 name2 uni2 fun2 ann))
-> Program tyname1 name1 uni1 fun1 ann
-> f (Program tyname2 name2 uni2 fun2 ann)
progTerm ((Term tyname name uni fun ann
  -> Const All (Term tyname name uni fun ann))
 -> Program tyname name uni fun ann
 -> Const All (Program tyname name uni fun ann))
-> ((Bool -> Const All Bool)
    -> Term tyname name uni fun ann
    -> Const All (Term tyname name uni fun ann))
-> Getting All (Program tyname name uni fun ann) Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Some (ValueOf uni) -> Const All (Some (ValueOf uni)))
-> Term tyname name uni fun ann
-> Const All (Term tyname name uni fun ann)
forall tyname name (uni :: * -> *) fun ann (f :: * -> *).
(Contravariant f, Applicative f) =>
(Some (ValueOf uni) -> f (Some (ValueOf uni)))
-> Term tyname name uni fun ann -> f (Term tyname name uni fun ann)
termConstantsDeep ((Some (ValueOf uni) -> Const All (Some (ValueOf uni)))
 -> Term tyname name uni fun ann
 -> Const All (Term tyname name uni fun ann))
-> ((Bool -> Const All Bool)
    -> Some (ValueOf uni) -> Const All (Some (ValueOf uni)))
-> (Bool -> Const All Bool)
-> Term tyname name uni fun ann
-> Const All (Term tyname name uni fun ann)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Some (ValueOf uni) -> Bool)
-> (Bool -> Const All Bool)
-> Some (ValueOf uni)
-> Const All (Some (ValueOf uni))
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to (Bool -> Bool
not (Bool -> Bool)
-> (Some (ValueOf uni) -> Bool) -> Some (ValueOf uni) -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Some (ValueOf uni) -> Bool
p)

genName :: PLC.AstGen Name
genName :: AstGen Name
genName = (Name -> Bool) -> AstGen Name -> AstGen Name
forall (m :: * -> *) a. MonadGen m => (a -> Bool) -> m a -> m a
Gen.filterT (Bool -> Bool
not (Bool -> Bool) -> (Name -> Bool) -> Name -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Bool
forall {a}. (Eq a, IsString a) => a -> Bool
isPirKw (Text -> Bool) -> (Name -> Text) -> Name -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name -> Text
_nameText) AstGen Name
PLC.genName where
    isPirKw :: a -> Bool
isPirKw a
name = a
name a -> [a] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem`
        [ a
"vardecl", a
"typedecl"
        , a
"let"
        , a
"nonrec", a
"rec"
        , a
"termbind", a
"typebind", a
"datatypebind"
        , a
"datatype"
        ]

genTyName :: PLC.AstGen TyName
genTyName :: AstGen TyName
genTyName = Name -> TyName
TyName (Name -> TyName) -> AstGen Name -> AstGen TyName
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen Name
genName

genRecursivity :: MonadGen m => m Recursivity
genRecursivity :: forall (m :: * -> *). MonadGen m => m Recursivity
genRecursivity = [Recursivity] -> m Recursivity
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadGen m) =>
f a -> m a
Gen.element [Recursivity
Rec, Recursivity
NonRec]

genStrictness :: MonadGen m => m Strictness
genStrictness :: forall (m :: * -> *). MonadGen m => m Strictness
genStrictness = [Strictness] -> m Strictness
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadGen m) =>
f a -> m a
Gen.element [Strictness
Strict, Strictness
NonStrict]

genVarDecl :: PLC.AstGen (VarDecl TyName Name PLC.DefaultUni ())
genVarDecl :: AstGen (VarDecl TyName Name DefaultUni ())
genVarDecl = ()
-> Name
-> Type TyName DefaultUni ()
-> VarDecl TyName Name DefaultUni ()
forall tyname name (uni :: * -> *) ann.
ann -> name -> Type tyname uni ann -> VarDecl tyname name uni ann
VarDecl () (Name
 -> Type TyName DefaultUni () -> VarDecl TyName Name DefaultUni ())
-> AstGen Name
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni () -> VarDecl TyName Name DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen Name
genName GenT
  (Reader [Name])
  (Type TyName DefaultUni () -> VarDecl TyName Name DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> AstGen (VarDecl TyName Name DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType

genTyVarDecl :: PLC.AstGen (TyVarDecl TyName ())
genTyVarDecl :: AstGen (TyVarDecl TyName ())
genTyVarDecl = () -> TyName -> Kind () -> TyVarDecl TyName ()
forall tyname ann.
ann -> tyname -> Kind ann -> TyVarDecl tyname ann
TyVarDecl () (TyName -> Kind () -> TyVarDecl TyName ())
-> AstGen TyName
-> GenT (Reader [Name]) (Kind () -> TyVarDecl TyName ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen TyName
genTyName GenT (Reader [Name]) (Kind () -> TyVarDecl TyName ())
-> GenT (Reader [Name]) (Kind ()) -> AstGen (TyVarDecl TyName ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Kind ())
genKind

genDatatype :: PLC.AstGen (Datatype TyName Name PLC.DefaultUni ())
genDatatype :: AstGen (Datatype TyName Name DefaultUni ())
genDatatype = ()
-> TyVarDecl TyName ()
-> [TyVarDecl TyName ()]
-> Name
-> [VarDecl TyName Name DefaultUni ()]
-> Datatype TyName Name DefaultUni ()
forall tyname name (uni :: * -> *) a.
a
-> TyVarDecl tyname a
-> [TyVarDecl tyname a]
-> name
-> [VarDecl tyname name uni a]
-> Datatype tyname name uni a
Datatype () (TyVarDecl TyName ()
 -> [TyVarDecl TyName ()]
 -> Name
 -> [VarDecl TyName Name DefaultUni ()]
 -> Datatype TyName Name DefaultUni ())
-> AstGen (TyVarDecl TyName ())
-> GenT
     (Reader [Name])
     ([TyVarDecl TyName ()]
      -> Name
      -> [VarDecl TyName Name DefaultUni ()]
      -> Datatype TyName Name DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen (TyVarDecl TyName ())
genTyVarDecl GenT
  (Reader [Name])
  ([TyVarDecl TyName ()]
   -> Name
   -> [VarDecl TyName Name DefaultUni ()]
   -> Datatype TyName Name DefaultUni ())
-> GenT (Reader [Name]) [TyVarDecl TyName ()]
-> GenT
     (Reader [Name])
     (Name
      -> [VarDecl TyName Name DefaultUni ()]
      -> Datatype TyName Name DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AstGen (TyVarDecl TyName ())
-> GenT (Reader [Name]) [TyVarDecl TyName ()]
forall {a}. GenT (Reader [Name]) a -> GenT (Reader [Name]) [a]
listOf AstGen (TyVarDecl TyName ())
genTyVarDecl GenT
  (Reader [Name])
  (Name
   -> [VarDecl TyName Name DefaultUni ()]
   -> Datatype TyName Name DefaultUni ())
-> AstGen Name
-> GenT
     (Reader [Name])
     ([VarDecl TyName Name DefaultUni ()]
      -> Datatype TyName Name DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AstGen Name
genName GenT
  (Reader [Name])
  ([VarDecl TyName Name DefaultUni ()]
   -> Datatype TyName Name DefaultUni ())
-> GenT (Reader [Name]) [VarDecl TyName Name DefaultUni ()]
-> AstGen (Datatype TyName Name DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AstGen (VarDecl TyName Name DefaultUni ())
-> GenT (Reader [Name]) [VarDecl TyName Name DefaultUni ()]
forall {a}. GenT (Reader [Name]) a -> GenT (Reader [Name]) [a]
listOf AstGen (VarDecl TyName Name DefaultUni ())
genVarDecl
    where listOf :: GenT (Reader [Name]) a -> GenT (Reader [Name]) [a]
listOf = Range Int -> GenT (Reader [Name]) a -> GenT (Reader [Name]) [a]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10)

genBinding :: PLC.AstGen (Binding TyName Name PLC.DefaultUni PLC.DefaultFun ())
genBinding :: AstGen (Binding TyName Name DefaultUni DefaultFun ())
genBinding = [AstGen (Binding TyName Name DefaultUni DefaultFun ())]
-> AstGen (Binding TyName Name DefaultUni DefaultFun ())
forall (m :: * -> *) a. MonadGen m => [m a] -> m a
Gen.choice [AstGen (Binding TyName Name DefaultUni DefaultFun ())
genTermBind, AstGen (Binding TyName Name DefaultUni DefaultFun ())
forall {name} {fun}.
GenT (Reader [Name]) (Binding TyName name DefaultUni fun ())
genTypeBind, AstGen (Binding TyName Name DefaultUni DefaultFun ())
forall {fun}.
GenT (Reader [Name]) (Binding TyName Name DefaultUni fun ())
genDatatypeBind] where
    genTermBind :: AstGen (Binding TyName Name DefaultUni DefaultFun ())
genTermBind = ()
-> Strictness
-> VarDecl TyName Name DefaultUni ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Binding TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Strictness
-> VarDecl tyname name uni a
-> Term tyname name uni fun a
-> Binding tyname name uni fun a
TermBind () (Strictness
 -> VarDecl TyName Name DefaultUni ()
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Binding TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) Strictness
-> GenT
     (Reader [Name])
     (VarDecl TyName Name DefaultUni ()
      -> Term TyName Name DefaultUni DefaultFun ()
      -> Binding TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) Strictness
forall (m :: * -> *). MonadGen m => m Strictness
genStrictness GenT
  (Reader [Name])
  (VarDecl TyName Name DefaultUni ()
   -> Term TyName Name DefaultUni DefaultFun ()
   -> Binding TyName Name DefaultUni DefaultFun ())
-> AstGen (VarDecl TyName Name DefaultUni ())
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Binding TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> AstGen (VarDecl TyName Name DefaultUni ())
genVarDecl GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Binding TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> AstGen (Binding TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    genTypeBind :: GenT (Reader [Name]) (Binding TyName name DefaultUni fun ())
genTypeBind = ()
-> TyVarDecl TyName ()
-> Type TyName DefaultUni ()
-> Binding TyName name DefaultUni fun ()
forall tyname name (uni :: * -> *) fun a.
a
-> TyVarDecl tyname a
-> Type tyname uni a
-> Binding tyname name uni fun a
TypeBind () (TyVarDecl TyName ()
 -> Type TyName DefaultUni ()
 -> Binding TyName name DefaultUni fun ())
-> AstGen (TyVarDecl TyName ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni ()
      -> Binding TyName name DefaultUni fun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen (TyVarDecl TyName ())
genTyVarDecl GenT
  (Reader [Name])
  (Type TyName DefaultUni ()
   -> Binding TyName name DefaultUni fun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Binding TyName name DefaultUni fun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    genDatatypeBind :: GenT (Reader [Name]) (Binding TyName Name DefaultUni fun ())
genDatatypeBind = ()
-> Datatype TyName Name DefaultUni ()
-> Binding TyName Name DefaultUni fun ()
forall tyname name (uni :: * -> *) fun a.
a -> Datatype tyname name uni a -> Binding tyname name uni fun a
DatatypeBind () (Datatype TyName Name DefaultUni ()
 -> Binding TyName Name DefaultUni fun ())
-> AstGen (Datatype TyName Name DefaultUni ())
-> GenT (Reader [Name]) (Binding TyName Name DefaultUni fun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen (Datatype TyName Name DefaultUni ())
genDatatype

genType :: PLC.AstGen (Type TyName PLC.DefaultUni ())
genType :: GenT (Reader [Name]) (Type TyName DefaultUni ())
genType = [GenT (Reader [Name]) (Type TyName DefaultUni ())]
-> [GenT (Reader [Name]) (Type TyName DefaultUni ())]
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
forall (m :: * -> *) a. MonadGen m => [m a] -> [m a] -> m a
simpleRecursive [GenT (Reader [Name]) (Type TyName DefaultUni ())]
nonRecursive [GenT (Reader [Name]) (Type TyName DefaultUni ())]
recursive where
    varGen :: GenT (Reader [Name]) (Type TyName uni ())
varGen = () -> TyName -> Type TyName uni ()
forall tyname (uni :: * -> *) ann.
ann -> tyname -> Type tyname uni ann
TyVar () (TyName -> Type TyName uni ())
-> AstGen TyName -> GenT (Reader [Name]) (Type TyName uni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen TyName
genTyName
    funGen :: GenT (Reader [Name]) (Type TyName DefaultUni ())
funGen = ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
forall tyname (uni :: * -> *) ann.
ann
-> Type tyname uni ann
-> Type tyname uni ann
-> Type tyname uni ann
TyFun () (Type TyName DefaultUni ()
 -> Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni () -> Type TyName DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    lamGen :: GenT (Reader [Name]) (Type TyName DefaultUni ())
lamGen = ()
-> TyName
-> Kind ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
forall tyname (uni :: * -> *) ann.
ann
-> tyname -> Kind ann -> Type tyname uni ann -> Type tyname uni ann
TyLam () (TyName
 -> Kind ()
 -> Type TyName DefaultUni ()
 -> Type TyName DefaultUni ())
-> AstGen TyName
-> GenT
     (Reader [Name])
     (Kind () -> Type TyName DefaultUni () -> Type TyName DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen TyName
genTyName GenT
  (Reader [Name])
  (Kind () -> Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Kind ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni () -> Type TyName DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Kind ())
genKind GenT
  (Reader [Name])
  (Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    forallGen :: GenT (Reader [Name]) (Type TyName DefaultUni ())
forallGen = ()
-> TyName
-> Kind ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
forall tyname (uni :: * -> *) ann.
ann
-> tyname -> Kind ann -> Type tyname uni ann -> Type tyname uni ann
TyForall () (TyName
 -> Kind ()
 -> Type TyName DefaultUni ()
 -> Type TyName DefaultUni ())
-> AstGen TyName
-> GenT
     (Reader [Name])
     (Kind () -> Type TyName DefaultUni () -> Type TyName DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen TyName
genTyName GenT
  (Reader [Name])
  (Kind () -> Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Kind ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni () -> Type TyName DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Kind ())
genKind GenT
  (Reader [Name])
  (Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    applyGen :: GenT (Reader [Name]) (Type TyName DefaultUni ())
applyGen = ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
forall tyname (uni :: * -> *) ann.
ann
-> Type tyname uni ann
-> Type tyname uni ann
-> Type tyname uni ann
TyApp () (Type TyName DefaultUni ()
 -> Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni () -> Type TyName DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Type TyName DefaultUni () -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    sopGen :: GenT (Reader [Name]) (Type TyName DefaultUni ())
sopGen = () -> [[Type TyName DefaultUni ()]] -> Type TyName DefaultUni ()
forall tyname (uni :: * -> *) ann.
ann -> [[Type tyname uni ann]] -> Type tyname uni ann
TySOP () ([[Type TyName DefaultUni ()]] -> Type TyName DefaultUni ())
-> GenT (Reader [Name]) [[Type TyName DefaultUni ()]]
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Range Int
-> GenT (Reader [Name]) [Type TyName DefaultUni ()]
-> GenT (Reader [Name]) [[Type TyName DefaultUni ()]]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) (Range Int
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) [Type TyName DefaultUni ()]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) GenT (Reader [Name]) (Type TyName DefaultUni ())
genType))
    recursive :: [GenT (Reader [Name]) (Type TyName DefaultUni ())]
recursive = [GenT (Reader [Name]) (Type TyName DefaultUni ())
funGen, GenT (Reader [Name]) (Type TyName DefaultUni ())
applyGen, GenT (Reader [Name]) (Type TyName DefaultUni ())
sopGen]
    nonRecursive :: [GenT (Reader [Name]) (Type TyName DefaultUni ())]
nonRecursive = [GenT (Reader [Name]) (Type TyName DefaultUni ())
forall {uni :: * -> *}. GenT (Reader [Name]) (Type TyName uni ())
varGen, GenT (Reader [Name]) (Type TyName DefaultUni ())
lamGen, GenT (Reader [Name]) (Type TyName DefaultUni ())
forallGen]

genTerm :: PLC.AstGen (Term TyName Name PLC.DefaultUni PLC.DefaultFun ())
genTerm :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm = [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())]
-> [GenT
      (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())]
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall (m :: * -> *) a. MonadGen m => [m a] -> [m a] -> m a
simpleRecursive [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())]
nonRecursive [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())]
recursive where
    varGen :: GenT (Reader [Name]) (Term tyname Name uni fun ())
varGen = () -> Name -> Term tyname Name uni fun ()
forall tyname name (uni :: * -> *) fun a.
a -> name -> Term tyname name uni fun a
Var () (Name -> Term tyname Name uni fun ())
-> AstGen Name
-> GenT (Reader [Name]) (Term tyname Name uni fun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen Name
genName
    absGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
absGen = ()
-> TyName
-> Kind ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> tyname
-> Kind a
-> Term tyname name uni fun a
-> Term tyname name uni fun a
TyAbs () (TyName
 -> Kind ()
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> AstGen TyName
-> GenT
     (Reader [Name])
     (Kind ()
      -> Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen TyName
genTyName GenT
  (Reader [Name])
  (Kind ()
   -> Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Kind ())
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Kind ())
genKind GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    instGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
instGen = ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Type TyName DefaultUni ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Term tyname name uni fun a
-> Type tyname uni a
-> Term tyname name uni fun a
TyInst () (Term TyName Name DefaultUni DefaultFun ()
 -> Type TyName DefaultUni ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm GenT
  (Reader [Name])
  (Type TyName DefaultUni ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    lamGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
lamGen = ()
-> Name
-> Type TyName DefaultUni ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> name
-> Type tyname uni a
-> Term tyname name uni fun a
-> Term tyname name uni fun a
LamAbs () (Name
 -> Type TyName DefaultUni ()
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> AstGen Name
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni ()
      -> Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> AstGen Name
genName GenT
  (Reader [Name])
  (Type TyName DefaultUni ()
   -> Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    applyGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
applyGen = ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Term tyname name uni fun a
-> Term tyname name uni fun a
-> Term tyname name uni fun a
Apply () (Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    unwrapGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
unwrapGen = ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a -> Term tyname name uni fun a -> Term tyname name uni fun a
Unwrap () (Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    wrapGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
wrapGen = ()
-> Type TyName DefaultUni ()
-> Type TyName DefaultUni ()
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Type tyname uni a
-> Type tyname uni a
-> Term tyname name uni fun a
-> Term tyname name uni fun a
IWrap () (Type TyName DefaultUni ()
 -> Type TyName DefaultUni ()
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Type TyName DefaultUni ()
      -> Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Type TyName DefaultUni ()
   -> Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    constrGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
constrGen = ()
-> Type TyName DefaultUni ()
-> Word64
-> [Term TyName Name DefaultUni DefaultFun ()]
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Type tyname uni a
-> Word64
-> [Term tyname name uni fun a]
-> Term tyname name uni fun a
Constr () (Type TyName DefaultUni ()
 -> Word64
 -> [Term TyName Name DefaultUni DefaultFun ()]
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Word64
      -> [Term TyName Name DefaultUni DefaultFun ()]
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Word64
   -> [Term TyName Name DefaultUni DefaultFun ()]
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) Word64
-> GenT
     (Reader [Name])
     ([Term TyName Name DefaultUni DefaultFun ()]
      -> Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Range Word64 -> GenT (Reader [Name]) Word64
forall (m :: * -> *). MonadGen m => Range Word64 -> m Word64
Gen.word64 (Word64 -> Word64 -> Range Word64
forall a. Integral a => a -> a -> Range a
Range.linear Word64
0 Word64
10) GenT
  (Reader [Name])
  ([Term TyName Name DefaultUni DefaultFun ()]
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) [Term TyName Name DefaultUni DefaultFun ()]
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Range Int
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) [Term TyName Name DefaultUni DefaultFun ()]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    caseGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
caseGen = ()
-> Type TyName DefaultUni ()
-> Term TyName Name DefaultUni DefaultFun ()
-> [Term TyName Name DefaultUni DefaultFun ()]
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Type tyname uni a
-> Term tyname name uni fun a
-> [Term tyname name uni fun a]
-> Term tyname name uni fun a
Case () (Type TyName DefaultUni ()
 -> Term TyName Name DefaultUni DefaultFun ()
 -> [Term TyName Name DefaultUni DefaultFun ()]
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> [Term TyName Name DefaultUni DefaultFun ()]
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> [Term TyName Name DefaultUni DefaultFun ()]
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT
     (Reader [Name])
     ([Term TyName Name DefaultUni DefaultFun ()]
      -> Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm GenT
  (Reader [Name])
  ([Term TyName Name DefaultUni DefaultFun ()]
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) [Term TyName Name DefaultUni DefaultFun ()]
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Range Int
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) [Term TyName Name DefaultUni DefaultFun ()]
forall (m :: * -> *) a. MonadGen m => Range Int -> m a -> m [a]
Gen.list (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
0 Int
10) GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    errorGen :: GenT (Reader [Name]) (Term TyName name DefaultUni fun ())
errorGen = ()
-> Type TyName DefaultUni () -> Term TyName name DefaultUni fun ()
forall tyname name (uni :: * -> *) fun a.
a -> Type tyname uni a -> Term tyname name uni fun a
Error () (Type TyName DefaultUni () -> Term TyName name DefaultUni fun ())
-> GenT (Reader [Name]) (Type TyName DefaultUni ())
-> GenT (Reader [Name]) (Term TyName name DefaultUni fun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Type TyName DefaultUni ())
genType
    letGen :: GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
letGen = ()
-> Recursivity
-> NonEmpty (Binding TyName Name DefaultUni DefaultFun ())
-> Term TyName Name DefaultUni DefaultFun ()
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a
-> Recursivity
-> NonEmpty (Binding tyname name uni fun a)
-> Term tyname name uni fun a
-> Term tyname name uni fun a
Let () (Recursivity
 -> NonEmpty (Binding TyName Name DefaultUni DefaultFun ())
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) Recursivity
-> GenT
     (Reader [Name])
     (NonEmpty (Binding TyName Name DefaultUni DefaultFun ())
      -> Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) Recursivity
forall (m :: * -> *). MonadGen m => m Recursivity
genRecursivity GenT
  (Reader [Name])
  (NonEmpty (Binding TyName Name DefaultUni DefaultFun ())
   -> Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT
     (Reader [Name])
     (NonEmpty (Binding TyName Name DefaultUni DefaultFun ()))
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Range Int
-> AstGen (Binding TyName Name DefaultUni DefaultFun ())
-> GenT
     (Reader [Name])
     (NonEmpty (Binding TyName Name DefaultUni DefaultFun ()))
forall (m :: * -> *) a.
MonadGen m =>
Range Int -> m a -> m (NonEmpty a)
Gen.nonEmpty (Int -> Int -> Range Int
forall a. Integral a => a -> a -> Range a
Range.linear Int
1 Int
10) AstGen (Binding TyName Name DefaultUni DefaultFun ())
genBinding GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm
    recursive :: [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())]
recursive = [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
absGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
instGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
lamGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
applyGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
unwrapGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
wrapGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
letGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
constrGen, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
caseGen]
    nonRecursive :: [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())]
nonRecursive = [GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall {tyname} {uni :: * -> *} {fun}.
GenT (Reader [Name]) (Term tyname Name uni fun ())
varGen, ()
-> Some (ValueOf DefaultUni)
-> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a -> Some (ValueOf uni) -> Term tyname name uni fun a
Constant () (Some (ValueOf DefaultUni)
 -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Some (ValueOf DefaultUni))
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) (Some (ValueOf DefaultUni))
genConstant, () -> DefaultFun -> Term TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun a.
a -> fun -> Term tyname name uni fun a
Builtin () (DefaultFun -> Term TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) DefaultFun
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) DefaultFun
forall fun. (Bounded fun, Enum fun) => AstGen fun
genBuiltin, GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
forall {name} {fun}.
GenT (Reader [Name]) (Term TyName name DefaultUni fun ())
errorGen]

genProgram :: PLC.AstGen (Program TyName Name PLC.DefaultUni PLC.DefaultFun ())
genProgram :: AstGen (Program TyName Name DefaultUni DefaultFun ())
genProgram = ()
-> Version
-> Term TyName Name DefaultUni DefaultFun ()
-> Program TyName Name DefaultUni DefaultFun ()
forall tyname name (uni :: * -> *) fun ann.
ann
-> Version
-> Term tyname name uni fun ann
-> Program tyname name uni fun ann
Program () (Version
 -> Term TyName Name DefaultUni DefaultFun ()
 -> Program TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) Version
-> GenT
     (Reader [Name])
     (Term TyName Name DefaultUni DefaultFun ()
      -> Program TyName Name DefaultUni DefaultFun ())
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> GenT (Reader [Name]) Version
forall (m :: * -> *). MonadGen m => m Version
genVersion GenT
  (Reader [Name])
  (Term TyName Name DefaultUni DefaultFun ()
   -> Program TyName Name DefaultUni DefaultFun ())
-> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
-> AstGen (Program TyName Name DefaultUni DefaultFun ())
forall a b.
GenT (Reader [Name]) (a -> b)
-> GenT (Reader [Name]) a -> GenT (Reader [Name]) b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> GenT (Reader [Name]) (Term TyName Name DefaultUni DefaultFun ())
genTerm