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

Fix & simplify SOP encoding example comment #6231

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions plutus-core/plutus-ir/src/PlutusIR/Compiler/Datatype.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,17 @@ We still need to think about the types. In general, we need:

For example, consider 'data Maybe a = Nothing | Just a'. Then:
- The type corresponding to the datatype is:
Maybe = \(t :: *) . sop [] [a]
Maybe = \(a :: *) . sop [] [a]
- The type of the constructors are:
Just : forall (t :: *) . a -> Maybe a
Nothing : forall (t :: *) . Maybe a
Nothing : forall (a :: *) . Maybe a
Just : forall (a :: *) . a -> Maybe a
- The terms for the constructors are:
Just = /\(t :: *) \(x :: t) . constr (Maybe t) 1 x
Nothing = /\(t :: *) . constr 0 (Maybe t)
Nothing = /\(a :: *) . constr 0 (Maybe a)
Just = /\(a :: *) \(x :: a) . constr 1 (Maybe a) x
- The type of the destructor is:
match_Maybe :: forall (t :: *) . Maybe t -> forall (out_Maybe :: *) . out_Maybe -> (t -> out_Maybe) -> out_Maybe
match_Maybe :: forall (a :: *) . Maybe a -> forall (out_Maybe :: *) . out_Maybe -> (a -> out_Maybe) -> out_Maybe
- The term for the destructor is:
match_Maybe = /\(t :: *) \(x : Maybe t) /\(out_Maybe :: *) \(case_Nothing :: out_Maybe) (case_Just :: t -> out_Maybe) .
match_Maybe = /\(a :: *) \(x : Maybe a) /\(out_Maybe :: *) \(case_Nothing :: out_Maybe) (case_Just :: a -> out_Maybe) .
case out_Maybe x case_Nothing case_Just

-- General case
Expand Down
Loading