Skip to content

Commit

Permalink
Remove principals from primitive types as per PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
0xd34df00d committed Oct 30, 2023
1 parent cb5fc24 commit b756a96
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 20 deletions.
2 changes: 0 additions & 2 deletions pact-core/Pact/Core/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ data ArgTypeError
| ATETable
| ATEClosure
| ATEModRef
| ATEPrincipal
deriving (Show)

instance Pretty ArgTypeError where
Expand All @@ -232,7 +231,6 @@ instance Pretty ArgTypeError where
ATETable -> "[table]"
ATEClosure -> "[closure]"
ATEModRef -> "[modref]"
ATEPrincipal -> "[principal]"


-- | All fatal execution errors which should pause
Expand Down
1 change: 0 additions & 1 deletion pact-core/Pact/Core/IR/Eval/Runtime/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ toArgTypeError = \case
PGuard _ -> ATEPrim PrimGuard
PModRef _ -> ATEModRef
PCapToken _ -> ATEClosure
PPrincipal _ -> ATEPrincipal
VTable{} -> ATETable
VClosure{} -> ATEClosure

Expand Down
6 changes: 0 additions & 6 deletions pact-core/Pact/Core/PactValue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import Pact.Core.Literal
import Pact.Core.Pretty
import Pact.Core.ModRefs
import Pact.Core.Capabilities
import Pact.Core.Principal

import qualified Pact.Core.Pretty as Pretty

Expand All @@ -49,7 +48,6 @@ data PactValue
| PModRef ModRef
| PCapToken (CapToken FullyQualifiedName PactValue)
| PTime !PactTime.UTCTime
| PPrincipal !Principal
deriving (Eq, Show, Ord)

makePrisms ''PactValue
Expand Down Expand Up @@ -81,7 +79,6 @@ instance Pretty PactValue where
PCapToken (CapToken fqn args) ->
parens (pretty (fqnToQualName fqn) <> if null args then mempty else hsep (pretty <$> args))
PTime t -> pretty (PactTime.formatTime "%Y-%m-%d %H:%M:%S%Q %Z" t)
PPrincipal p -> pretty $ mkPrincipalIdent p


-- | Check that a `PactValue` has the provided `Type`, returning
Expand Down Expand Up @@ -125,9 +122,6 @@ checkPvType ty = \case
PTime _ -> case ty of
TyTime -> Just TyTime
_ -> Nothing
PPrincipal _ -> case ty of
TyPrincipal -> Just TyPrincipal
_ -> Nothing



Expand Down
1 change: 0 additions & 1 deletion pact-core/Pact/Core/StableEncoding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ instance J.Encode (StableEncoding PactValue) where
PModRef mr -> J.build (StableEncoding mr)
PCapToken _ct -> error "not implemented"
PTime pt -> J.build (StableEncoding pt)
PPrincipal pr -> J.build (StableEncoding pr)
{-# INLINABLE build #-}

-- | Stable encoding of `PactContinuation FullyQualifiedName PactValue`
Expand Down
1 change: 0 additions & 1 deletion pact-core/Pact/Core/Syntax/LexUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ primType i = \case
"list" -> pure TyPolyList
"object" -> pure TyPolyObject
"keyset" -> pure TyKeyset
"principal" -> pure TyPrincipal
e -> throwParseError (InvalidBaseType e) i

objType :: SpanInfo -> Text -> ParsedTyName -> ParserT Type
Expand Down
3 changes: 0 additions & 3 deletions pact-core/Pact/Core/Syntax/ParseTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ pattern TyUnit = TyPrim PrimUnit
pattern TyGuard :: Type
pattern TyGuard = TyPrim PrimGuard

pattern TyPrincipal :: Type
pattern TyPrincipal = TyPrim PrimPrincipal

instance Pretty Type where
pretty = \case
TyPrim prim -> pretty prim
Expand Down
6 changes: 0 additions & 6 deletions pact-core/Pact/Core/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ module Pact.Core.Type
, pattern TyTime
, pattern TyBool
, pattern TyString
, pattern TyPrincipal
, pattern TyUnit
, pattern TyGuard
, typeOfLit
Expand Down Expand Up @@ -54,7 +53,6 @@ data PrimType =
PrimString |
PrimGuard |
PrimTime |
PrimPrincipal |
PrimUnit
deriving (Eq,Ord,Show, Enum, Bounded)

Expand All @@ -66,7 +64,6 @@ instance Pretty PrimType where
PrimString -> "string"
PrimGuard -> "guard"
PrimTime -> "time"
PrimPrincipal -> "principal"
PrimUnit -> "unit"

-- Todo: caps are a bit strange here
Expand Down Expand Up @@ -114,9 +111,6 @@ pattern TyBool = TyPrim PrimBool
pattern TyString :: Type
pattern TyString = TyPrim PrimString

pattern TyPrincipal :: Type
pattern TyPrincipal = TyPrim PrimPrincipal

pattern TyUnit :: Type
pattern TyUnit = TyPrim PrimUnit

Expand Down

0 comments on commit b756a96

Please sign in to comment.