Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Builtins] Disentangle 'KnownTypeAst' from 'KnownTypeIn' #4312

Merged
Prev Previous commit
Next Next commit
Back to type synonyms
effectfully committed Jan 5, 2022

Unverified

This user has not yet uploaded their public signing key.
commit c42a9f2523c119bac5cb55d5d8274d0486a2590e
17 changes: 2 additions & 15 deletions plutus-core/plutus-core/src/PlutusCore/Constant/Typed.hs
Original file line number Diff line number Diff line change
@@ -514,17 +514,8 @@ type family ListToBinds (x :: [a]) :: [GADT.Some TyNameRep]
type instance ListToBinds '[] = '[]
type instance ListToBinds (x ': xs) = Merge (ToBinds x) (ListToBinds xs)

-- We need to be able to partially apply that in the definition of 'ImplementedKnownBuiltinTypeIn',
-- hence defining it as a class synonym.
-- | A constraint for \"@a@ is a 'KnownType' by means of being included in @uni@\".
class (HasConstantIn uni term, GShow uni, GEq uni, uni `Contains` a) =>
KnownBuiltinTypeIn uni term a
instance (HasConstantIn uni term, GShow uni, GEq uni, uni `Contains` a) =>
KnownBuiltinTypeIn uni term a

-- | A constraint for \"@a@ is a 'KnownType' by means of being included in @uni@\".

-- type KnownBuiltinTypeIn uni term a = (HasConstantIn uni term, GShow uni, GEq uni, uni `Contains` a)
type KnownBuiltinTypeIn uni term a = (HasConstantIn uni term, GShow uni, GEq uni, uni `Contains` a)

-- | A constraint for \"@a@ is a 'KnownType' by means of being included in @UniOf term@\".
type KnownBuiltinType term a = KnownBuiltinTypeIn (UniOf term) term a
@@ -629,11 +620,7 @@ class uni ~ UniOf term => KnownTypeIn uni term a where
{-# INLINE readKnown #-}

-- | Haskell types known to exist on the PLC side. See 'KnownTypeIn'.
class (KnownTypeAst (UniOf term) a, KnownTypeIn (UniOf term) term a) => KnownType term a
instance (KnownTypeAst (UniOf term) a, KnownTypeIn (UniOf term) term a) => KnownType term a

-- -- | Haskell types known to exist on the PLC side. See 'KnownTypeIn'.
-- type KnownType term a = (KnownTypeAst (UniOf term) a, KnownTypeIn (UniOf term) term a)
type KnownType term a = (KnownTypeAst (UniOf term) a, KnownTypeIn (UniOf term) term a)

-- | Same as 'readKnown', but the cause of a potential failure is the provided term itself.
readKnownSelf