{-# OPTIONS_GHC -fno-warn-missing-methods #-}
{-# LANGUAGE DataKinds,
TypeOperators,
PolyKinds,
GADTs,
TypeInType,
RankNTypes,
StandaloneDeriving,
FlexibleInstances,
FlexibleContexts,
ConstraintKinds,
MultiParamTypeClasses,
FunctionalDependencies,
UndecidableInstances,
ScopedTypeVariables,
TypeFamilies,
InstanceSigs,
AllowAmbiguousTypes,
TypeApplications,
PatternSynonyms
#-}
module Data.GenRec
(
Rec(ConsRec, EmptyRec),
TagField(TagField),
WrapField,
UnWrap,
untagField,
(.=.),
(#),
(.*.),
OrdType,
Cmp,
ShowRec,
ShowField,
ShowLabel,
OpLookup(OpLookup),
lookup,
OpExtend(OpExtend),
OpUpdate(OpUpdate),
update,
emptyGenRec,
module Data.GenRec.Label
) where
import Data.Kind
import Data.Proxy
import Data.GenRec.Label
import Data.Type.Require
import Data.Type.Bool
import Prelude hiding (lookup)
import GHC.TypeLits
type family a == b where
a == b = Equal a b
data Rec (c :: k) (r :: [(k', k'')]) :: Type where
EmptyRec :: Rec c '[]
ConsRec :: TagField c l v -> Rec c r -> Rec c ('( l, v) ': r)
emptyGenRec :: Rec c '[]
emptyGenRec = Rec c '[]
forall k k' k'' (c :: k). Rec c '[]
EmptyRec
data TagField (c :: k) (l :: k') (v :: k'') where
TagField :: Label c -> Label l -> WrapField c v -> TagField c l v
infix 4 .=.
(Label l
l :: Label l) .=. :: Label l -> WrapField c v -> TagField c l v
.=. (WrapField c v
v :: v) = Label c -> Label l -> WrapField c v -> TagField c l v
forall k k' k'' (c :: k) (l :: k') (v :: k'').
Label c -> Label l -> WrapField c v -> TagField c l v
TagField Label c
forall k (l :: k). Label l
Label Label l
l WrapField c v
v
type family WrapField (c :: k') (v :: k) :: Type
type family UnWrap (t :: Type) :: [(k,k')]
type instance UnWrap (Rec c (r :: [(k, k')])) = (r :: [(k, k')])
untagField :: TagField c l v -> WrapField c v
untagField :: TagField c l v -> WrapField c v
untagField (TagField Label c
lc Label l
lv WrapField c v
v) = WrapField c v
v
class OrdType k where
type Cmp (a :: k) (b :: k) :: Ordering
instance OrdType Symbol where
type Cmp a b = CmpSymbol a b
type family ShowRec c :: Symbol
type family ShowField c :: Symbol
type family ShowLabel (l :: k) :: Symbol
data OpLookup (c :: Type)
(l :: k)
(r :: [(k, k')]) :: Type where
OpLookup :: Label l -> Rec c r -> OpLookup c l r
data OpLookup' (b :: Ordering)
(c :: Type)
(l :: k)
(r :: [(k, k')]) :: Type where
OpLookup' :: Proxy b -> Label l -> Rec c r -> OpLookup' b c l r
instance
Require (OpLookup' (Cmp l l') c l ('( l', v) ': r)) ctx
=>
Require (OpLookup c l ('( l', v) ': r)) ctx where
type ReqR (OpLookup c l ('( l', v) ': r)) =
ReqR (OpLookup' (Cmp l l') c l ('( l', v) ': r))
req :: Proxy ctx
-> OpLookup c l ('(l', v) : r)
-> ReqR (OpLookup c l ('(l', v) : r))
req Proxy ctx
ctx (OpLookup Label l
l Rec c ('(l', v) : r)
r) =
Proxy ctx
-> OpLookup' (Cmp l l') c l ('(l', v) : r)
-> ReqR (OpLookup' (Cmp l l') c l ('(l', v) : r))
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy ctx
ctx (Proxy (Cmp l l')
-> Label l
-> Rec c ('(l', v) : r)
-> OpLookup' (Cmp l l') c l ('(l', v) : r)
forall k k' (b :: Ordering) (l :: k) c (r :: [(k, k')]).
Proxy b -> Label l -> Rec c r -> OpLookup' b c l r
OpLookup' (Proxy (Cmp l l')
forall k (t :: k). Proxy t
Proxy @(Cmp l l')) Label l
l Rec c ('(l', v) : r)
r)
instance
Require (OpError (Text "field not Found on " :<>: Text (ShowRec c)
:$$: Text "looking up the " :<>: Text (ShowField c)
:<>: Text " " :<>: Text (ShowLabel l)
)) ctx
=>
Require (OpLookup c l ( '[] :: [(k,k')])) ctx where
type ReqR (OpLookup c l ('[] :: [(k,k')]) ) = ()
req :: Proxy ctx -> OpLookup c l '[] -> ReqR (OpLookup c l '[])
req = Proxy ctx -> OpLookup c l '[] -> ReqR (OpLookup c l '[])
forall a. HasCallStack => a
undefined
instance
Require (OpLookup' 'EQ c l ( '(l, v) ': r)) ctx where
type ReqR (OpLookup' 'EQ c l ( '(l, v) ': r)) =
WrapField c v
req :: Proxy ctx
-> OpLookup' 'EQ c l ('(l, v) : r)
-> ReqR (OpLookup' 'EQ c l ('(l, v) : r))
req Proxy ctx
Proxy (OpLookup' Proxy 'EQ
Proxy Label l
Label (ConsRec TagField c l v
f Rec c r
_)) =
TagField c l v -> WrapField c v
forall k' k' k (c :: k') (l :: k') (v :: k).
TagField c l v -> WrapField c v
untagField TagField c l v
f
instance (Require (OpLookup c l r) ctx)
=>
Require (OpLookup' 'GT c l ( '(l', v) ': r)) ctx where
type ReqR (OpLookup' 'GT c l ( '(l', v) ': r)) =
ReqR (OpLookup c l r)
req :: Proxy ctx
-> OpLookup' 'GT c l ('(l', v) : r)
-> ReqR (OpLookup' 'GT c l ('(l', v) : r))
req Proxy ctx
ctx (OpLookup' Proxy 'GT
Proxy Label l
l (ConsRec TagField c l v
_ Rec c r
r)) =
Proxy ctx -> OpLookup c l r -> ReqR (OpLookup c l r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy ctx
ctx (Label l -> Rec c r -> OpLookup c l r
forall k k' (l :: k) c (r :: [(k, k')]).
Label l -> Rec c r -> OpLookup c l r
OpLookup Label l
l Rec c r
r)
instance Require (OpError (Text "field not Found on " :<>: Text (ShowRec c)
:$$: Text "looking up the " :<>: Text (ShowField c)
:<>: Text " " :<>: ShowTE l
)) ctx
=>
Require (OpLookup' 'LT c l ( '(l', v) ': r)) ctx where
type ReqR (OpLookup' 'LT c l ( '(l', v) ': r)) = ()
req :: Proxy ctx
-> OpLookup' 'LT c l ('(l', v) : r)
-> ReqR (OpLookup' 'LT c l ('(l', v) : r))
req Proxy ctx
ctx (OpLookup' Proxy 'LT
Proxy Label l
l (ConsRec TagField c l v
_ Rec c r
r)) = ()
(#) :: forall c l r ctx v. RequireR (OpLookupCall c l r) ctx v =>
Rec c r -> Label l -> v
Rec c r
r # :: Rec c r -> Label l -> v
# Label l
l = Proxy ctx -> OpLookupCall c l r -> ReqR (OpLookupCall c l r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req (Proxy ctx
forall k (t :: k). Proxy t
Proxy @ctx) (Label l -> Rec c r -> OpLookupCall c l r
forall k k' (l :: k) c (r :: [(k, k')]).
Label l -> Rec c r -> OpLookupCall c l r
OpLookupCall Label l
l Rec c r
r)
data OpUpdate (c :: Type)
(l :: k)
(v :: k')
(r :: [(k, k')]) :: Type where
OpUpdate :: Label l -> WrapField c v -> Rec c r
-> OpUpdate c l v r
data OpUpdate' (b :: Ordering)
(c :: Type)
(l :: k)
(v :: k')
(r :: [(k, k')]) :: Type where
OpUpdate' :: Proxy b -> Label l -> WrapField c v -> Rec c r
-> OpUpdate' b c l v r
instance (Require (OpUpdate' (Cmp l l') c l v ( '(l', v') ': r) ) ctx )
=>
Require (OpUpdate c l v ( '(l', v') ': r) ) ctx where
type ReqR (OpUpdate c l v ( '(l', v') ': r) ) =
ReqR (OpUpdate' (Cmp l l') c l v ( '(l', v') ': r) )
req :: Proxy ctx
-> OpUpdate c l v ('(l', v') : r)
-> ReqR (OpUpdate c l v ('(l', v') : r))
req Proxy ctx
ctx (OpUpdate Label l
l WrapField c v
f Rec c ('(l', v') : r)
r) =
(Proxy ctx
-> OpUpdate' (Cmp l l') c l v ('(l', v') : r)
-> ReqR (OpUpdate' (Cmp l l') c l v ('(l', v') : r))
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req @(OpUpdate' (Cmp l l') _ _ v _ ))
Proxy ctx
ctx (Proxy (Cmp l l')
-> Label l
-> WrapField c v
-> Rec c ('(l', v') : r)
-> OpUpdate' (Cmp l l') c l v ('(l', v') : r)
forall k k' (b :: Ordering) (l :: k) c (v :: k') (r :: [(k, k')]).
Proxy b
-> Label l -> WrapField c v -> Rec c r -> OpUpdate' b c l v r
OpUpdate' (Proxy (Cmp l l')
forall k (t :: k). Proxy t
Proxy @(Cmp l l')) Label l
l WrapField c v
f Rec c ('(l', v') : r)
r)
instance (Require (OpError (Text "field not Found on " :<>: Text (ShowRec c)
:$$: Text "updating the " :<>: Text (ShowField c)
:<>: ShowTE l)) ctx)
=>
Require (OpUpdate c l v '[]) ctx where
type ReqR (OpUpdate c l v ('[] ) ) = Rec c '[]
req :: Proxy ctx -> OpUpdate c l v '[] -> ReqR (OpUpdate c l v '[])
req = Proxy ctx -> OpUpdate c l v '[] -> ReqR (OpUpdate c l v '[])
forall a. HasCallStack => a
undefined
instance
Require (OpUpdate' 'EQ c l v ( '(l, v') ': r)) ctx where
type ReqR (OpUpdate' 'EQ c l v ( '(l, v') ': r)) =
Rec c ( '(l, v) ': r)
req :: Proxy ctx
-> OpUpdate' 'EQ c l v ('(l, v') : r)
-> ReqR (OpUpdate' 'EQ c l v ('(l, v') : r))
req Proxy ctx
ctx (OpUpdate' Proxy 'EQ
proxy Label l
label WrapField c v
field (ConsRec TagField c l v
tgf Rec c r
r)) =
TagField c l v -> Rec c r -> Rec c ('(l, v) : r)
forall k k' k'' (c :: k) (l :: k') (v :: k'') (r :: [(k', k'')]).
TagField c l v -> Rec c r -> Rec c ('(l, v) : r)
ConsRec (Label c -> Label l -> WrapField c v -> TagField c l v
forall k k' k'' (c :: k) (l :: k') (v :: k'').
Label c -> Label l -> WrapField c v -> TagField c l v
TagField Label c
forall k (l :: k). Label l
Label Label l
label WrapField c v
field) Rec c r
r
instance
( Require (OpUpdate c l v r) ctx
, ( '(l', v') : r0) ~ a
, ReqR (OpUpdate c l v r) ~ Rec c r0
)
=>
Require (OpUpdate' 'GT c l v ( '(l',v') ': r)) ctx where
type ReqR (OpUpdate' 'GT c l v ( '(l',v') ': r)) =
Rec c ( '(l',v') ': (UnWrap (ReqR (OpUpdate c l v r))))
req :: Proxy ctx
-> OpUpdate' 'GT c l v ('(l', v') : r)
-> ReqR (OpUpdate' 'GT c l v ('(l', v') : r))
req Proxy ctx
ctx (OpUpdate' Proxy 'GT
_ Label l
l WrapField c v
f (ConsRec TagField c l v
field (r :: Rec c r))) =
TagField c l v -> Rec c r0 -> Rec c ('(l, v) : r0)
forall k k' k'' (c :: k) (l :: k') (v :: k'') (r :: [(k', k'')]).
TagField c l v -> Rec c r -> Rec c ('(l, v) : r)
ConsRec TagField c l v
field (Rec c r0 -> Rec c ('(l, v) : r0))
-> Rec c r0 -> Rec c ('(l, v) : r0)
forall a b. (a -> b) -> a -> b
$ (Proxy ctx -> OpUpdate c l v r -> ReqR (OpUpdate c l v r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req @(OpUpdate _ _ v r)) Proxy ctx
ctx (Label l -> WrapField c v -> Rec c r -> OpUpdate c l v r
forall k k' (l :: k) c (v :: k') (r :: [(k, k')]).
Label l -> WrapField c v -> Rec c r -> OpUpdate c l v r
OpUpdate Label l
l WrapField c v
f Rec c r
r)
instance (Require (OpError (Text "field not Found on " :<>: Text (ShowRec c)
:$$: Text "updating the " :<>: Text (ShowField c)
:<>: ShowTE l)) ctx)
=>
Require (OpUpdate' 'LT c l v ( '(l',v') ': r)) ctx where
type ReqR (OpUpdate' 'LT c l v ( '(l',v') ': r)) =
()
req :: Proxy ctx
-> OpUpdate' 'LT c l v ('(l', v') : r)
-> ReqR (OpUpdate' 'LT c l v ('(l', v') : r))
req = Proxy ctx
-> OpUpdate' 'LT c l v ('(l', v') : r)
-> ReqR (OpUpdate' 'LT c l v ('(l', v') : r))
forall a. HasCallStack => a
undefined
update :: Label l -> v -> Rec c r -> ReqR (OpUpdate c l v r)
update (Label l
l :: Label l) (v
v :: v) (Rec c r
r :: Rec c r) =
Proxy ctx -> OpUpdate c l v r -> ReqR (OpUpdate c l v r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy ctx
forall k (t :: k). Proxy t
Proxy (Label l -> WrapField c v -> Rec c r -> OpUpdate c l v r
forall k k' (l :: k) c (v :: k') (r :: [(k, k')]).
Label l -> WrapField c v -> Rec c r -> OpUpdate c l v r
OpUpdate @l @c @v @r Label l
l v
WrapField c v
v Rec c r
r)
lookup :: Label c -> Rec c r -> ReqR (OpLookup c c r)
lookup (Label c
l :: Label l) (Rec c r
r :: Rec c r) =
Proxy ctx -> OpLookup c c r -> ReqR (OpLookup c c r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy ctx
forall k (t :: k). Proxy t
Proxy (Label c -> Rec c r -> OpLookup c c r
forall k k' (l :: k) c (r :: [(k, k')]).
Label l -> Rec c r -> OpLookup c l r
OpLookup @c @l @r Label c
l Rec c r
r)
data OpExtend (c :: Type)
(l :: k)
(v :: k')
(r :: [(k, k')]) :: Type where
OpExtend :: Label l -> WrapField c v -> Rec c r
-> OpExtend c l v r
data OpExtend' (b :: Ordering)
(c :: Type)
(l :: k)
(v :: k')
(r :: [(k, k')]) :: Type where
OpExtend' :: Proxy b -> Label l -> WrapField c v -> Rec c r
-> OpExtend' b c l v r
instance
Require (OpExtend c l v '[]) ctx where
type ReqR (OpExtend c l v '[]) =
Rec c '[ '(l , v)]
req :: Proxy ctx -> OpExtend c l v '[] -> ReqR (OpExtend c l v '[])
req Proxy ctx
ctx (OpExtend Label l
l WrapField c v
v Rec c '[]
EmptyRec) =
TagField c l v -> Rec c '[] -> Rec c '[ '(l, v)]
forall k k' k'' (c :: k) (l :: k') (v :: k'') (r :: [(k', k'')]).
TagField c l v -> Rec c r -> Rec c ('(l, v) : r)
ConsRec (Label c -> Label l -> WrapField c v -> TagField c l v
forall k k' k'' (c :: k) (l :: k') (v :: k'').
Label c -> Label l -> WrapField c v -> TagField c l v
TagField (Label c
forall k (l :: k). Label l
Label @c) Label l
l WrapField c v
v) Rec c '[]
forall k k' k'' (c :: k). Rec c '[]
EmptyRec
instance
Require (OpExtend' (Cmp l l') c l v ('(l', v') : r)) ctx
=>
Require (OpExtend c l v ( '(l', v') ': r)) ctx where
type ReqR (OpExtend c l v ( '(l', v') ': r)) =
ReqR (OpExtend' (Cmp l l') c l v ( '(l', v') ': r))
req :: Proxy ctx
-> OpExtend c l v ('(l', v') : r)
-> ReqR (OpExtend c l v ('(l', v') : r))
req Proxy ctx
ctx (OpExtend Label l
l WrapField c v
v (Rec c ('(l', v') : r)
r :: Rec c ( '(l', v') ': r)) ) =
Proxy ctx
-> OpExtend' (Cmp l l') c l v ('(l', v') : r)
-> ReqR (OpExtend' (Cmp l l') c l v ('(l', v') : r))
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy ctx
ctx (Proxy (Cmp l l')
-> Label l
-> WrapField c v
-> Rec c ('(l', v') : r)
-> OpExtend' (Cmp l l') c l v ('(l', v') : r)
forall k k' (b :: Ordering) (l :: k) c (v :: k') (r :: [(k, k')]).
Proxy b
-> Label l -> WrapField c v -> Rec c r -> OpExtend' b c l v r
OpExtend' @(Cmp l l') @l @c @v Proxy (Cmp l l')
forall k (t :: k). Proxy t
Proxy Label l
l WrapField c v
v Rec c ('(l', v') : r)
r)
instance
(Require (OpExtend c l v r) ctx
, ( '(l', v') ': r0 ) ~ a
, ReqR (OpExtend c l v r) ~ Rec c r0
)
=>
Require (OpExtend' 'GT c l v ( '(l', v') ': r)) ctx where
type ReqR (OpExtend' 'GT c l v ( '(l', v') ': r)) =
Rec c ( '(l', v') ': UnWrap (ReqR (OpExtend c l v r)))
req :: Proxy ctx
-> OpExtend' 'GT c l v ('(l', v') : r)
-> ReqR (OpExtend' 'GT c l v ('(l', v') : r))
req Proxy ctx
ctx (OpExtend' Proxy 'GT
Proxy Label l
l WrapField c v
v (ConsRec TagField c l v
lv Rec c r
r)) =
TagField c l v -> Rec c r0 -> Rec c ('(l, v) : r0)
forall k k' k'' (c :: k) (l :: k') (v :: k'') (r :: [(k', k'')]).
TagField c l v -> Rec c r -> Rec c ('(l, v) : r)
ConsRec TagField c l v
lv (Rec c r0 -> Rec c ('(l, v) : r0))
-> Rec c r0 -> Rec c ('(l, v) : r0)
forall a b. (a -> b) -> a -> b
$ Proxy ctx -> OpExtend c l v r -> ReqR (OpExtend c l v r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy ctx
ctx (Label l -> WrapField c v -> Rec c r -> OpExtend c l v r
forall k k' (l :: k) c (v :: k') (r :: [(k, k')]).
Label l -> WrapField c v -> Rec c r -> OpExtend c l v r
OpExtend @_ @_ @v Label l
l WrapField c v
v Rec c r
r)
instance
Require (OpExtend' 'LT c l v ( '(l', v') ': r)) ctx where
type ReqR (OpExtend' 'LT c l v ( '(l', v') ': r)) =
Rec c ( '(l, v) ': ( '(l', v') ': r))
req :: Proxy ctx
-> OpExtend' 'LT c l v ('(l', v') : r)
-> ReqR (OpExtend' 'LT c l v ('(l', v') : r))
req Proxy ctx
ctx (OpExtend' Proxy 'LT
Proxy Label l
l WrapField c v
v Rec c ('(l', v') : r)
r) =
TagField c l v
-> Rec c ('(l', v') : r) -> Rec c ('(l, v) : '(l', v') : r)
forall k k' k'' (c :: k) (l :: k') (v :: k'') (r :: [(k', k'')]).
TagField c l v -> Rec c r -> Rec c ('(l, v) : r)
ConsRec (Label c -> Label l -> WrapField c v -> TagField c l v
forall k k' k'' (c :: k) (l :: k') (v :: k'').
Label c -> Label l -> WrapField c v -> TagField c l v
TagField Label c
forall k (l :: k). Label l
Label Label l
l WrapField c v
v) Rec c ('(l', v') : r)
r
instance
(Require (OpError (Text "cannot extend " :<>: Text (ShowRec c)
:$$: Text "collision in " :<>: Text (ShowField c)
:<>: Text " ":<>: ShowTE l)) ctx)
=>
Require (OpExtend' 'EQ c l v ( '(l, v') ': r)) ctx where
type ReqR (OpExtend' 'EQ c l v ( '(l, v') ': r)) = ()
req :: Proxy ctx
-> OpExtend' 'EQ c l v ('(l, v') : r)
-> ReqR (OpExtend' 'EQ c l v ('(l, v') : r))
req Proxy ctx
ctx = OpExtend' 'EQ c l v ('(l, v') : r)
-> ReqR (OpExtend' 'EQ c l v ('(l, v') : r))
forall a. HasCallStack => a
undefined
infixr 2 .*.
(TagField Label c
c Label l
l WrapField c v
v :: TagField c l v) .*. :: TagField c l v -> Rec c r -> ReqR (OpExtend c l v r)
.*. (Rec c r
r :: Rec c r) =
Proxy '[ 'Text ""] -> OpExtend c l v r -> ReqR (OpExtend c l v r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req Proxy '[ 'Text ""]
emptyCtx (Label l -> WrapField c v -> Rec c r -> OpExtend c l v r
forall k k' (l :: k) c (v :: k') (r :: [(k, k')]).
Label l -> WrapField c v -> Rec c r -> OpExtend c l v r
OpExtend @l @c @v @r Label l
l WrapField c v
v Rec c r
r)
type family LabelSetF (r :: [(k, k')]) :: Bool where
LabelSetF '[] = True
LabelSetF '[ '(l, v)] = True
LabelSetF ( '(l, v) ': '(l',v') ': r) =
Cmp l l' == LT && LabelSetF ( '(l',v') ': r)
data OpLookupCall
(c :: Type)
(l :: k)
(r :: [(k, k')]) :: Type where
OpLookupCall :: Label l -> Rec c r -> OpLookupCall c l r
instance
Require (OpLookup c l r) ( ShowType r ': ctx)
=>
Require (OpLookupCall c l r) ctx where
type ReqR (OpLookupCall c l r) =
ReqR (OpLookup c l r)
req :: Proxy ctx -> OpLookupCall c l r -> ReqR (OpLookupCall c l r)
req Proxy ctx
ctx (OpLookupCall Label l
l Rec c r
r) =
Proxy ('ShowType r : ctx)
-> OpLookup c l r -> ReqR (OpLookup c l r)
forall op (ctx :: [ErrorMessage]).
Require op ctx =>
Proxy ctx -> op -> ReqR op
req (Proxy ('ShowType r : ctx)
forall k (t :: k). Proxy t
Proxy @ (ShowType r ': ctx)) (Label l -> Rec c r -> OpLookup c l r
forall k k' (l :: k) c (r :: [(k, k')]).
Label l -> Rec c r -> OpLookup c l r
OpLookup Label l
l Rec c r
r)