-
Notifications
You must be signed in to change notification settings - Fork 339
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
Showing
3 changed files
with
35 additions
and
2 deletions.
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
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,26 @@ | ||
open import Agda.Builtin.IO | ||
open import Agda.Builtin.String | ||
open import Agda.Builtin.Unit | ||
|
||
postulate | ||
putStr : String → IO ⊤ | ||
|
||
{-# FOREIGN GHC import qualified Data.Text.IO #-} | ||
{-# COMPILE GHC putStr = Data.Text.IO.putStr #-} | ||
{-# COMPILE JS putStr = | ||
function (x) { | ||
return function(cb) { | ||
process.stdout.write(x); cb(0); }; } #-} | ||
|
||
F : Set → Set | ||
F A = A → A | ||
|
||
data D : Set where | ||
c₀ : D | ||
c₁ : F D | ||
|
||
f : D → String | ||
f c₀ = "OK\n" | ||
f (c₁ x) = f x | ||
|
||
main = putStr (f (c₁ c₀)) |
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,5 @@ | ||
EXECUTED_PROGRAM | ||
|
||
ret > ExitSuccess | ||
out > OK | ||
out > |