-- GeNeRaTeD fOr: ../../CBS-beta/Funcons-beta/Computations/Normal/Interacting/Interacting.cbs
{-# LANGUAGE OverloadedStrings #-}

module Funcons.Core.Computations.Normal.Interacting.Interacting where

import Funcons.EDSL

import Funcons.Operations hiding (Values,libFromList)
entities :: [a]
entities = []

types :: TypeRelation
types = [(Name, DataTypeMembers)] -> TypeRelation
typeEnvFromList
    []

funcons :: FunconLibrary
funcons = [(Name, EvalFunction)] -> FunconLibrary
libFromList
    [(Name
"print",StrictFuncon -> EvalFunction
StrictFuncon StrictFuncon
stepPrint),(Name
"read",NullaryFuncon -> EvalFunction
NullaryFuncon NullaryFuncon
stepRead)]

print_ :: [Funcons] -> Funcons
print_ [Funcons]
fargs = Name -> [Funcons] -> Funcons
FApp Name
"print" ([Funcons]
fargs)
stepPrint :: StrictFuncon
stepPrint [Values]
fargs =
    [NullaryFuncon] -> [MSOS StepRes] -> NullaryFuncon
evalRules [] [MSOS StepRes
step1]
    where step1 :: MSOS StepRes
step1 = do
            let env :: Map k a
env = Map k a
forall k a. Map k a
emptyEnv
            Env
env <- [Values] -> [VPattern] -> Env -> MSOS Env
lifted_vsMatch [Values]
fargs [VPattern -> FTerm -> VPattern
VPAnnotated (MetaVar -> SeqSortOp -> VPattern
VPSeqVar MetaVar
"V*" SeqSortOp
StarOp) (FTerm -> SeqSortOp -> FTerm
TSortSeq (Name -> FTerm
TName Name
"values") SeqSortOp
StarOp)] Env
forall k a. Map k a
env
            Name -> FTerm -> Env -> MSOS ()
writeOutTerm Name
"standard-out" (MetaVar -> FTerm
TVar MetaVar
"V*") Env
env
            FTerm -> Env -> MSOS StepRes
stepTermTo (Name -> FTerm
TName Name
"null-value") Env
env

read_ :: Funcons
read_ = Name -> Funcons
FName Name
"read"
stepRead :: NullaryFuncon
stepRead = [NullaryFuncon] -> [MSOS StepRes] -> NullaryFuncon
evalRules [] [MSOS StepRes
step1,MSOS StepRes
step2]
    where step1 :: MSOS StepRes
step1 = do
            let env :: Map k a
env = Map k a
forall k a. Map k a
emptyEnv
            Env
env <- Name -> VPattern -> Env -> MSOS Env
matchInput Name
"standard-in" (VPattern -> FTerm -> VPattern
VPAnnotated (MetaVar -> VPattern
VPMetaVar MetaVar
"V") (FTerm -> FTerm
TSortComplement (Name -> FTerm
TName Name
"null-type"))) Env
forall k a. Map k a
env
            FTerm -> Env -> MSOS StepRes
stepTermTo (MetaVar -> FTerm
TVar MetaVar
"V") Env
env
          step2 :: MSOS StepRes
step2 = do
            let env :: Map k a
env = Map k a
forall k a. Map k a
emptyEnv
            Env
env <- Name -> VPattern -> Env -> MSOS Env
matchInput Name
"standard-in" (Name -> [VPattern] -> VPattern
PADT Name
"null-value" []) Env
forall k a. Map k a
env
            FTerm -> Env -> MSOS StepRes
stepTermTo (Name -> FTerm
TName Name
"fail") Env
env