{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}

module Cubix.Language.Parametric.Syntax.Function (
  -- Function calls
    FunctionCallAttrsL
  , FunctionExpL
  , FunctionArgumentsL
  , FunctionCallL
  , FunctionCall(..)
  , EmptyFunctionCallAttrs(..)
  , FunctionIdent(..)

  , FunctionArgumentL
  , FunctionArgumentList(..)
  , ReceiverL
  , ReceiverArg(..)
  , PositionalArgExpL
  , PositionalArgument(..)

  , pattern FunctionCall'
  ,        iFunctionCall
  , pattern EmptyFunctionCallAttrs'
  ,        iEmptyFunctionCallAttrs
  , pattern FunctionIdent'
  ,        iFunctionIdent
  , pattern FunctionArgumentList'
  ,        iFunctionArgumentList
  , pattern ReceiverArg'
  ,        iReceiverArg
  , pattern PositionalArgument'
  ,        iPositionalArgument

  -- Function decls

  , FunctionDeclAttrsL
  , FunctionParameterDeclL
  , FunctionParameterDeclAttrsL
  , FunctionDeclL
  , FunctionDecl(..)
  , EmptyFunctionDeclAttrs(..)
  , SelfParameterDecl(..)
  , PositionalParameterDeclOptionalIdent(..)
  , PositionalParameterDeclWithIdent(..)

  , pattern FunctionDecl'
  ,        iFunctionDecl
  , pattern EmptyFunctionDeclAttrs'
  ,        iEmptyFunctionDeclAttrs
  , pattern SelfParameterDecl'
  ,        iSelfParameterDecl
  , pattern PositionalParameterDeclOptionalIdent'
  ,        iPositionalParameterDeclOptionalIdent
  , pattern PositionalParameterDeclWithIdent'
  ,        iPositionalParameterDeclWithIdent

  -- Function defns

  , FunctionDefAttrsL
  , FunctionParameterL
  , FunctionBodyL
  , FunctionDefL
  , FunctionDef(..)
  , EmptyFunctionDefAttrs(..)
  , SelfParameter(..)
  , ParameterAttrsL
  , PositionalParameter(..)
  , EmptyParameterAttrs(..)

  , pattern FunctionDef'
  ,        iFunctionDef
  , pattern EmptyFunctionDefAttrs'
  ,        iEmptyFunctionDefAttrs
  , pattern EmptyParameterAttrs
  ,        iEmptyParameterAttrs
  , pattern SelfParameter'
  ,        iSelfParameter
  , pattern PositionalParameter'
  ,        iPositionalParameter
  , pattern EmptyParameterAttrs'
  ,        iEmptyParameterAttrs

  ) where

import Data.Comp.Multi (CxtS,project, (:-<:), HFunctor, All )

import Cubix.Language.Parametric.Derive
import Cubix.Language.Parametric.Syntax.VarDecl

---------------------------------------------------------------------------------
---------------------------              Function Calls         -----------------
---------------------------------------------------------------------------------

data FunctionCallAttrsL
data FunctionExpL
data FunctionArgumentsL


-- | Upon evaluating a FunctionCall node, the following occurs:
--  1) The FunctionExp is evaluated.
--  2) The function call attrs are evaluated.
--  3) The arguments are evaluated, in unspecified order. (Remember, we model C, which has unspecified order)
--  4) A function is looked up based on the function exp and the arguments, and is then invoked with the given arguments.
--
--  1 and 2 happpen in unspecified order. 1 and 2 happen before 3, which happens before 4.
--
--  All positional arguments in the invocation and the function definition are matched up sequentially
--  If argument types do not line up (e.g.: pass a positional arg at a receiver position), this is undefined;
--  said positional argument is ignored in the above computation
data FunctionCallL
data FunctionCall e l where
  FunctionCall :: e FunctionCallAttrsL -> e FunctionExpL -> e FunctionArgumentsL -> FunctionCall e FunctionCallL

deriveAll [''FunctionCall]

pattern FunctionCall' ::
  ( FunctionCall :-<: fs
  , All HFunctor fs
  ) => CxtS h fs a FunctionCallAttrsL
  -> CxtS h fs a FunctionExpL
  -> CxtS h fs a FunctionArgumentsL
  -> CxtS h fs a FunctionCallL
pattern $bFunctionCall' :: CxtS h fs a FunctionCallAttrsL
-> CxtS h fs a FunctionExpL
-> CxtS h fs a FunctionArgumentsL
-> CxtS h fs a FunctionCallL
$mFunctionCall' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(FunctionCall :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionCallL
-> (CxtS h fs a FunctionCallAttrsL
    -> CxtS h fs a FunctionExpL -> CxtS h fs a FunctionArgumentsL -> r)
-> (Void# -> r)
-> r
FunctionCall' a e args <- (project -> Just (FunctionCall a e args)) where
  FunctionCall' a :: CxtS h fs a FunctionCallAttrsL
a e :: CxtS h fs a FunctionExpL
e args :: CxtS h fs a FunctionArgumentsL
args = CxtS h fs a FunctionCallAttrsL
-> CxtS h fs a FunctionExpL
-> CxtS h fs a FunctionArgumentsL
-> CxtS h fs a FunctionCallL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(FunctionCall :-<: fs, InjF fs FunctionCallL j) =>
CxtS h fs a FunctionCallAttrsL
-> CxtS h fs a FunctionExpL
-> CxtS h fs a FunctionArgumentsL
-> CxtS h fs a j
iFunctionCall CxtS h fs a FunctionCallAttrsL
a CxtS h fs a FunctionExpL
e CxtS h fs a FunctionArgumentsL
args

data EmptyFunctionCallAttrs (e :: * -> *) l where
  EmptyFunctionCallAttrs :: EmptyFunctionCallAttrs e FunctionCallAttrsL

deriveAll [''EmptyFunctionCallAttrs]

pattern EmptyFunctionCallAttrs' :: (EmptyFunctionCallAttrs :-<: fs, All HFunctor fs) => CxtS h fs a FunctionCallAttrsL
pattern $bEmptyFunctionCallAttrs' :: CxtS h fs a FunctionCallAttrsL
$mEmptyFunctionCallAttrs' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(EmptyFunctionCallAttrs :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionCallAttrsL -> (Void# -> r) -> (Void# -> r) -> r
EmptyFunctionCallAttrs' <- (project -> Just EmptyFunctionCallAttrs) where
  EmptyFunctionCallAttrs' = CxtS h fs a FunctionCallAttrsL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(EmptyFunctionCallAttrs :-<: fs, InjF fs FunctionCallAttrsL j) =>
CxtS h fs a j
iEmptyFunctionCallAttrs

data FunctionIdent e l where
  FunctionIdent :: e IdentL -> FunctionIdent e FunctionExpL

deriveAll [''FunctionIdent]

pattern FunctionIdent' :: (FunctionIdent :-<: fs, All HFunctor fs) => CxtS h fs a IdentL -> CxtS h fs a FunctionExpL
pattern $bFunctionIdent' :: CxtS h fs a IdentL -> CxtS h fs a FunctionExpL
$mFunctionIdent' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(FunctionIdent :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionExpL
-> (CxtS h fs a IdentL -> r) -> (Void# -> r) -> r
FunctionIdent' n <- (project -> Just (FunctionIdent n)) where
  FunctionIdent' n :: CxtS h fs a IdentL
n = CxtS h fs a IdentL -> CxtS h fs a FunctionExpL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(FunctionIdent :-<: fs, InjF fs FunctionExpL j) =>
CxtS h fs a IdentL -> CxtS h fs a j
iFunctionIdent CxtS h fs a IdentL
n

-- | Additional non-syntactic assumptions:
-- * At most one argument is receiver, and
--     it's at the front of the list if exists.
-- * Positional and receiver args are before other args
data FunctionArgumentL
data FunctionArgumentList e l where
  FunctionArgumentList :: e [FunctionArgumentL] -> FunctionArgumentList e FunctionArgumentsL

deriveAll [''FunctionArgumentList]

pattern FunctionArgumentList' :: (FunctionArgumentList :-<: fs, All HFunctor fs) => CxtS h fs a [FunctionArgumentL] -> CxtS h fs a FunctionArgumentsL
pattern $bFunctionArgumentList' :: CxtS h fs a [FunctionArgumentL] -> CxtS h fs a FunctionArgumentsL
$mFunctionArgumentList' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(FunctionArgumentList :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionArgumentsL
-> (CxtS h fs a [FunctionArgumentL] -> r) -> (Void# -> r) -> r
FunctionArgumentList' args <- (project -> Just (FunctionArgumentList args)) where
  FunctionArgumentList' args :: CxtS h fs a [FunctionArgumentL]
args = CxtS h fs a [FunctionArgumentL] -> CxtS h fs a FunctionArgumentsL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(FunctionArgumentList :-<: fs, InjF fs FunctionArgumentsL j) =>
CxtS h fs a [FunctionArgumentL] -> CxtS h fs a j
iFunctionArgumentList CxtS h fs a [FunctionArgumentL]
args

data ReceiverL
data ReceiverArg e l where
  ReceiverArg :: e ReceiverL -> ReceiverArg e FunctionArgumentL

deriveAll [''ReceiverArg]

pattern ReceiverArg' :: (ReceiverArg :-<: fs, All HFunctor fs) => CxtS h fs a ReceiverL -> CxtS h fs a FunctionArgumentL
pattern $bReceiverArg' :: CxtS h fs a ReceiverL -> CxtS h fs a FunctionArgumentL
$mReceiverArg' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(ReceiverArg :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionArgumentL
-> (CxtS h fs a ReceiverL -> r) -> (Void# -> r) -> r
ReceiverArg' x <- (project -> Just (ReceiverArg x)) where
  ReceiverArg' x :: CxtS h fs a ReceiverL
x = CxtS h fs a ReceiverL -> CxtS h fs a FunctionArgumentL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(ReceiverArg :-<: fs, InjF fs FunctionArgumentL j) =>
CxtS h fs a ReceiverL -> CxtS h fs a j
iReceiverArg CxtS h fs a ReceiverL
x

data PositionalArgExpL
data PositionalArgument e l where
  PositionalArgument :: e PositionalArgExpL -> PositionalArgument e FunctionArgumentL

deriveAll [''PositionalArgument]

pattern PositionalArgument' :: (PositionalArgument :-<: fs, All HFunctor fs) => CxtS h fs a PositionalArgExpL -> CxtS h fs a FunctionArgumentL
pattern $bPositionalArgument' :: CxtS h fs a PositionalArgExpL -> CxtS h fs a FunctionArgumentL
$mPositionalArgument' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(PositionalArgument :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionArgumentL
-> (CxtS h fs a PositionalArgExpL -> r) -> (Void# -> r) -> r
PositionalArgument' e <- (project -> Just (PositionalArgument e)) where
  PositionalArgument' e :: CxtS h fs a PositionalArgExpL
e = CxtS h fs a PositionalArgExpL -> CxtS h fs a FunctionArgumentL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(PositionalArgument :-<: fs, InjF fs FunctionArgumentL j) =>
CxtS h fs a PositionalArgExpL -> CxtS h fs a j
iPositionalArgument CxtS h fs a PositionalArgExpL
e


---------------------------------------------------------------------------------
---------------------------          Function Decls             -----------------
---------------------------------------------------------------------------------

data FunctionDeclAttrsL
data FunctionParameterDeclL

data FunctionDeclL
data FunctionDecl e l where
  FunctionDecl :: e FunctionDeclAttrsL -> e IdentL -> e [FunctionParameterDeclL] -> FunctionDecl e FunctionDeclL

deriveAll [''FunctionDecl]

pattern FunctionDecl' :: (FunctionDecl :-<: fs, All HFunctor fs) => CxtS h fs a FunctionDeclAttrsL -> CxtS h fs a IdentL -> CxtS h fs a [FunctionParameterDeclL] -> CxtS h fs a FunctionDeclL
pattern $bFunctionDecl' :: CxtS h fs a FunctionDeclAttrsL
-> CxtS h fs a IdentL
-> CxtS h fs a [FunctionParameterDeclL]
-> CxtS h fs a FunctionDeclL
$mFunctionDecl' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(FunctionDecl :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionDeclL
-> (CxtS h fs a FunctionDeclAttrsL
    -> CxtS h fs a IdentL -> CxtS h fs a [FunctionParameterDeclL] -> r)
-> (Void# -> r)
-> r
FunctionDecl' a n ps <- (project -> (Just (FunctionDecl a n ps))) where
  FunctionDecl' a :: CxtS h fs a FunctionDeclAttrsL
a n :: CxtS h fs a IdentL
n ps :: CxtS h fs a [FunctionParameterDeclL]
ps = CxtS h fs a FunctionDeclAttrsL
-> CxtS h fs a IdentL
-> CxtS h fs a [FunctionParameterDeclL]
-> CxtS h fs a FunctionDeclL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(FunctionDecl :-<: fs, InjF fs FunctionDeclL j) =>
CxtS h fs a FunctionDeclAttrsL
-> CxtS h fs a IdentL
-> CxtS h fs a [FunctionParameterDeclL]
-> CxtS h fs a j
iFunctionDecl CxtS h fs a FunctionDeclAttrsL
a CxtS h fs a IdentL
n CxtS h fs a [FunctionParameterDeclL]
ps

data EmptyFunctionDeclAttrs (e :: * -> *) l where
  EmptyFunctionDeclAttrs :: EmptyFunctionDeclAttrs e FunctionDeclAttrsL

deriveAll [''EmptyFunctionDeclAttrs]

pattern EmptyFunctionDeclAttrs' :: (EmptyFunctionDeclAttrs :-<: fs, All HFunctor fs) => CxtS h fs a FunctionDeclAttrsL
pattern $bEmptyFunctionDeclAttrs' :: CxtS h fs a FunctionDeclAttrsL
$mEmptyFunctionDeclAttrs' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(EmptyFunctionDeclAttrs :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionDeclAttrsL -> (Void# -> r) -> (Void# -> r) -> r
EmptyFunctionDeclAttrs' <- (project -> Just EmptyFunctionDeclAttrs) where
  EmptyFunctionDeclAttrs' = CxtS h fs a FunctionDeclAttrsL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(EmptyFunctionDeclAttrs :-<: fs, InjF fs FunctionDeclAttrsL j) =>
CxtS h fs a j
iEmptyFunctionDeclAttrs

data SelfParameterDecl (e :: * -> *) l where
  SelfParameterDecl :: SelfParameterDecl e FunctionParameterDeclL

deriveAll [''SelfParameterDecl]

pattern SelfParameterDecl' :: (SelfParameterDecl :-<: fs, All HFunctor fs) => CxtS h fs a FunctionParameterDeclL
pattern $bSelfParameterDecl' :: CxtS h fs a FunctionParameterDeclL
$mSelfParameterDecl' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(SelfParameterDecl :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionParameterDeclL
-> (Void# -> r) -> (Void# -> r) -> r
SelfParameterDecl' <- (project -> Just SelfParameterDecl) where
  SelfParameterDecl' = CxtS h fs a FunctionParameterDeclL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(SelfParameterDecl :-<: fs, InjF fs FunctionParameterDeclL j) =>
CxtS h fs a j
iSelfParameterDecl

data FunctionParameterDeclAttrsL

data PositionalParameterDeclOptionalIdent e l where
  PositionalParameterDeclOptionalIdent :: e FunctionParameterDeclAttrsL -> e (Maybe IdentL) -> PositionalParameterDeclOptionalIdent e FunctionParameterDeclL

deriveAll [''PositionalParameterDeclOptionalIdent]

pattern PositionalParameterDeclOptionalIdent' ::
  ( PositionalParameterDeclOptionalIdent :-<: fs
  , All HFunctor fs
  ) => CxtS h fs a FunctionParameterDeclAttrsL
  -> CxtS h fs a (Maybe IdentL)
  -> CxtS h fs a FunctionParameterDeclL
pattern $bPositionalParameterDeclOptionalIdent' :: CxtS h fs a FunctionParameterDeclAttrsL
-> CxtS h fs a (Maybe IdentL) -> CxtS h fs a FunctionParameterDeclL
$mPositionalParameterDeclOptionalIdent' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(PositionalParameterDeclOptionalIdent :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionParameterDeclL
-> (CxtS h fs a FunctionParameterDeclAttrsL
    -> CxtS h fs a (Maybe IdentL) -> r)
-> (Void# -> r)
-> r
PositionalParameterDeclOptionalIdent' a n <- (project -> Just (PositionalParameterDeclOptionalIdent a n)) where
  PositionalParameterDeclOptionalIdent' a :: CxtS h fs a FunctionParameterDeclAttrsL
a n :: CxtS h fs a (Maybe IdentL)
n = CxtS h fs a FunctionParameterDeclAttrsL
-> CxtS h fs a (Maybe IdentL) -> CxtS h fs a FunctionParameterDeclL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(PositionalParameterDeclOptionalIdent :-<: fs,
 InjF fs FunctionParameterDeclL j) =>
CxtS h fs a FunctionParameterDeclAttrsL
-> CxtS h fs a (Maybe IdentL) -> CxtS h fs a j
iPositionalParameterDeclOptionalIdent CxtS h fs a FunctionParameterDeclAttrsL
a CxtS h fs a (Maybe IdentL)
n

data PositionalParameterDeclWithIdent e l where
  PositionalParameterDeclWithIdent :: e FunctionParameterDeclAttrsL -> e IdentL -> PositionalParameterDeclWithIdent e FunctionParameterDeclL

deriveAll [''PositionalParameterDeclWithIdent]

pattern PositionalParameterDeclWithIdent' ::
  ( PositionalParameterDeclWithIdent :-<: fs
  , All HFunctor fs
  ) => CxtS h fs a FunctionParameterDeclAttrsL
  -> CxtS h fs a IdentL
  -> CxtS h fs a FunctionParameterDeclL
pattern $bPositionalParameterDeclWithIdent' :: CxtS h fs a FunctionParameterDeclAttrsL
-> CxtS h fs a IdentL -> CxtS h fs a FunctionParameterDeclL
$mPositionalParameterDeclWithIdent' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(PositionalParameterDeclWithIdent :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionParameterDeclL
-> (CxtS h fs a FunctionParameterDeclAttrsL
    -> CxtS h fs a IdentL -> r)
-> (Void# -> r)
-> r
PositionalParameterDeclWithIdent' a n <- (project -> Just (PositionalParameterDeclWithIdent a n)) where
  PositionalParameterDeclWithIdent' a :: CxtS h fs a FunctionParameterDeclAttrsL
a n :: CxtS h fs a IdentL
n = CxtS h fs a FunctionParameterDeclAttrsL
-> CxtS h fs a IdentL -> CxtS h fs a FunctionParameterDeclL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(PositionalParameterDeclWithIdent :-<: fs,
 InjF fs FunctionParameterDeclL j) =>
CxtS h fs a FunctionParameterDeclAttrsL
-> CxtS h fs a IdentL -> CxtS h fs a j
iPositionalParameterDeclWithIdent CxtS h fs a FunctionParameterDeclAttrsL
a CxtS h fs a IdentL
n


---------------------------------------------------------------------------------
---------------------------          Function Defns             -----------------
---------------------------------------------------------------------------------

data FunctionDefAttrsL
data FunctionParameterL
data FunctionBodyL
data FunctionDefL
data FunctionDef e l where
  FunctionDef :: e FunctionDefAttrsL -> e IdentL -> e [FunctionParameterL] -> e FunctionBodyL -> FunctionDef e FunctionDefL

deriveAll [''FunctionDef]

pattern FunctionDef' ::
  ( FunctionDef :-<: fs
  , All HFunctor fs
  ) => CxtS h fs a FunctionDefAttrsL
  -> CxtS h fs a IdentL
  -> CxtS h fs a [FunctionParameterL]
  -> CxtS h fs a FunctionBodyL
  -> CxtS h fs a FunctionDefL
pattern $bFunctionDef' :: CxtS h fs a FunctionDefAttrsL
-> CxtS h fs a IdentL
-> CxtS h fs a [FunctionParameterL]
-> CxtS h fs a FunctionBodyL
-> CxtS h fs a FunctionDefL
$mFunctionDef' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(FunctionDef :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionDefL
-> (CxtS h fs a FunctionDefAttrsL
    -> CxtS h fs a IdentL
    -> CxtS h fs a [FunctionParameterL]
    -> CxtS h fs a FunctionBodyL
    -> r)
-> (Void# -> r)
-> r
FunctionDef' attrs i args body <- (project -> Just (FunctionDef attrs i args body)) where
  FunctionDef' attrs :: CxtS h fs a FunctionDefAttrsL
attrs i :: CxtS h fs a IdentL
i args :: CxtS h fs a [FunctionParameterL]
args body :: CxtS h fs a FunctionBodyL
body = CxtS h fs a FunctionDefAttrsL
-> CxtS h fs a IdentL
-> CxtS h fs a [FunctionParameterL]
-> CxtS h fs a FunctionBodyL
-> CxtS h fs a FunctionDefL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(FunctionDef :-<: fs, InjF fs FunctionDefL j) =>
CxtS h fs a FunctionDefAttrsL
-> CxtS h fs a IdentL
-> CxtS h fs a [FunctionParameterL]
-> CxtS h fs a FunctionBodyL
-> CxtS h fs a j
iFunctionDef CxtS h fs a FunctionDefAttrsL
attrs CxtS h fs a IdentL
i CxtS h fs a [FunctionParameterL]
args CxtS h fs a FunctionBodyL
body

data EmptyFunctionDefAttrs (e :: * -> *) l where
  EmptyFunctionDefAttrs :: EmptyFunctionDefAttrs e FunctionDefAttrsL

deriveAll [''EmptyFunctionDefAttrs]

pattern EmptyFunctionDefAttrs' :: (EmptyFunctionDefAttrs :-<: fs, All HFunctor fs) => CxtS h fs a FunctionDefAttrsL
pattern $bEmptyFunctionDefAttrs' :: CxtS h fs a FunctionDefAttrsL
$mEmptyFunctionDefAttrs' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(EmptyFunctionDefAttrs :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionDefAttrsL -> (Void# -> r) -> (Void# -> r) -> r
EmptyFunctionDefAttrs' <- (project -> Just EmptyFunctionDefAttrs) where
  EmptyFunctionDefAttrs' = CxtS h fs a FunctionDefAttrsL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(EmptyFunctionDefAttrs :-<: fs, InjF fs FunctionDefAttrsL j) =>
CxtS h fs a j
iEmptyFunctionDefAttrs

data SelfParameter (e :: * -> *) l where
  SelfParameter :: SelfParameter e FunctionParameterL

deriveAll [''SelfParameter]

pattern SelfParameter' :: (SelfParameter :-<: fs, All HFunctor fs) => CxtS h fs a FunctionParameterL
pattern $bSelfParameter' :: CxtS h fs a FunctionParameterL
$mSelfParameter' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(SelfParameter :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionParameterL -> (Void# -> r) -> (Void# -> r) -> r
SelfParameter' <- (project -> Just SelfParameter) where
  SelfParameter' = CxtS h fs a FunctionParameterL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(SelfParameter :-<: fs, InjF fs FunctionParameterL j) =>
CxtS h fs a j
iSelfParameter

data ParameterAttrsL
data PositionalParameter e l where
  PositionalParameter :: e ParameterAttrsL -> e IdentL -> PositionalParameter e FunctionParameterL

deriveAll [''PositionalParameter]

pattern PositionalParameter' ::
  ( PositionalParameter :-<: fs, All HFunctor fs) => CxtS h fs a ParameterAttrsL -> CxtS h fs a IdentL -> CxtS h fs a FunctionParameterL
pattern $bPositionalParameter' :: CxtS h fs a ParameterAttrsL
-> CxtS h fs a IdentL -> CxtS h fs a FunctionParameterL
$mPositionalParameter' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(PositionalParameter :-<: fs, All HFunctor fs) =>
CxtS h fs a FunctionParameterL
-> (CxtS h fs a ParameterAttrsL -> CxtS h fs a IdentL -> r)
-> (Void# -> r)
-> r
PositionalParameter' attrs i <- (project -> Just (PositionalParameter attrs i)) where
  PositionalParameter' attrs :: CxtS h fs a ParameterAttrsL
attrs i :: CxtS h fs a IdentL
i = CxtS h fs a ParameterAttrsL
-> CxtS h fs a IdentL -> CxtS h fs a FunctionParameterL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(PositionalParameter :-<: fs, InjF fs FunctionParameterL j) =>
CxtS h fs a ParameterAttrsL -> CxtS h fs a IdentL -> CxtS h fs a j
iPositionalParameter CxtS h fs a ParameterAttrsL
attrs CxtS h fs a IdentL
i

data EmptyParameterAttrs (e :: * -> *) l where
  EmptyParameterAttrs :: EmptyParameterAttrs e ParameterAttrsL

deriveAll [''EmptyParameterAttrs]

pattern EmptyParameterAttrs' :: (EmptyParameterAttrs :-<: fs, All HFunctor fs) => CxtS h fs a ParameterAttrsL
pattern $bEmptyParameterAttrs' :: CxtS h fs a ParameterAttrsL
$mEmptyParameterAttrs' :: forall r (fs :: [(* -> *) -> * -> *]) h (a :: * -> *).
(EmptyParameterAttrs :-<: fs, All HFunctor fs) =>
CxtS h fs a ParameterAttrsL -> (Void# -> r) -> (Void# -> r) -> r
EmptyParameterAttrs' <- (project -> Just EmptyParameterAttrs) where
  EmptyParameterAttrs' = CxtS h fs a ParameterAttrsL
forall h (fs :: [(* -> *) -> * -> *]) (a :: * -> *) j.
(EmptyParameterAttrs :-<: fs, InjF fs ParameterAttrsL j) =>
CxtS h fs a j
iEmptyParameterAttrs