Skip to content

Commit

Permalink
A bit more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
effectfully committed May 10, 2022
1 parent c27e088 commit f6845ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plutus-core/plutus-core/src/PlutusCore/Builtin/KnownType.hs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ typeMismatchError uniExp uniAct = fromString $ concat
--
-- Moving from @ExceptT KnownTypeError Emitter@ to this data type gave us a speedup of 8% of total
-- evaluation time.
--
-- Logs are represented as a 'DList', because we don't particularly care about the efficiency of
-- logging, since there's no logging on the chain and builtins don't emit much anyway. Otherwise
-- we'd have to use @text-builder@ or @text-builder-linear@ or something of this sort.
data MakeKnownM a
= MakeKnownFailure (DList Text) KnownTypeError
| MakeKnownSuccess a
Expand Down Expand Up @@ -228,6 +232,8 @@ instance Applicative MakeKnownM where
MakeKnownSuccessWithLogs logs f <*> a = withLogs logs $ fmap f a
{-# INLINE (<*>) #-}

-- Better than the default implementation, because the value in the 'MakeKnownSuccess' case
-- doesn't need to be retained.
MakeKnownFailure logs err *> _ = MakeKnownFailure logs err
MakeKnownSuccess _ *> a = a
MakeKnownSuccessWithLogs logs _ *> a = withLogs logs a
Expand Down

0 comments on commit f6845ef

Please sign in to comment.