-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64e5ef5
commit 5f98b32
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
\begin{code} | ||
module Sharing where | ||
|
||
data ℕ : Set where | ||
zero : ℕ | ||
suc : ℕ → ℕ | ||
|
||
_+_ : ℕ → ℕ → ℕ | ||
zero + n = n | ||
suc m + n = suc (m + n) | ||
|
||
one = suc zero | ||
|
||
four = let two = one + one | ||
in two + two | ||
\end{code} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module MAlonzo.Code.Sharing where | ||
|
||
import MAlonzo.RTE | ||
import qualified MAlonzo.RTE | ||
import qualified Data.Text | ||
|
||
name2 = "Sharing.ℕ" | ||
d2 = () | ||
data T2 a0 = C4 | C6 a0 | ||
name8 = "Sharing._+_" | ||
d8 v0 v1 | ||
= case coe v0 of | ||
C4 -> coe v1 | ||
C6 v2 -> coe C6 (coe d8 v2 v1) | ||
_ -> ⊥ | ||
name16 = "Sharing.one" | ||
d16 = coe C6 C4 | ||
name18 = "Sharing.four" | ||
d18 = coe d8 (coe d8 d16 d16) | ||
(coe d8 d16 d16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters