{-# LANGUAGE AllowAmbiguousTypes  #-}
{-# LANGUAGE BlockArguments       #-}
{-# LANGUAGE DataKinds            #-}
{-# LANGUAGE FlexibleContexts     #-}
{-# LANGUAGE ImportQualifiedPost  #-}
{-# LANGUAGE OverloadedStrings    #-}
{-# LANGUAGE ScopedTypeVariables  #-}
{-# LANGUAGE TypeApplications     #-}
{-# LANGUAGE TypeFamilies         #-}
{-# LANGUAGE TypeOperators        #-}
{-# LANGUAGE UndecidableInstances #-}

module Dovetail.Core.Effect.Uncurried where

import Data.Foldable (fold)
import Data.Text (Text)
import Dovetail
import Dovetail.Core.Effect (Effect)
import Dovetail.Evaluate (builtIn)
import GHC.TypeLits (Nat, type (-))

type family Fn (n :: Nat) (ctx :: *) where
  Fn 1 ctx = Value ctx -> Effect ctx (Value ctx)
  Fn n ctx = Value ctx -> Fn (n - 1) ctx

env :: forall ctx. Env ctx
env :: Env ctx
env = do
  let _ModuleName :: ModuleName
_ModuleName = Text -> ModuleName
ModuleName Text
"Effect.Uncurried"

      effectFn :: forall (n :: Nat)
                . (ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx))
               => Text
               -> Env ctx
      effectFn :: Text -> Env ctx
effectFn Text
name = ModuleName -> Text -> (Fn n ctx -> Fn n ctx) -> Env ctx
forall ctx a. ToValue ctx a => ModuleName -> Text -> a -> Env ctx
builtIn @ctx @(Fn n ctx -> Fn n ctx) ModuleName
_ModuleName Text
name Fn n ctx -> Fn n ctx
forall a. a -> a
id

  [Env ctx] -> Env ctx
forall (t :: * -> *) m. (Foldable t, Monoid m) => t m -> m
fold
    [ Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @1 Text
"runEffectFn1"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @2 Text
"runEffectFn2"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @3 Text
"runEffectFn3"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @4 Text
"runEffectFn4"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @5 Text
"runEffectFn5"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @6 Text
"runEffectFn6"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @7 Text
"runEffectFn7"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @8 Text
"runEffectFn8"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @9 Text
"runEffectFn9"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @10 Text
"runEffectFn10"
    
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @1 Text
"mkEffectFn1"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @2 Text
"mkEffectFn2"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @3 Text
"mkEffectFn3"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @4 Text
"mkEffectFn4"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @5 Text
"mkEffectFn5"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @6 Text
"mkEffectFn6"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @7 Text
"mkEffectFn7"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @8 Text
"mkEffectFn8"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @9 Text
"mkEffectFn9"
    , Text -> Env ctx
forall (n :: Nat).
(ToValue ctx (Fn n ctx), ToValueRHS ctx (Fn n ctx)) =>
Text -> Env ctx
effectFn @10 Text
"mkEffectFn10"
    ]