-
Notifications
You must be signed in to change notification settings - Fork 37
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
4a9a614
commit a42b630
Showing
17 changed files
with
124 additions
and
0 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,12 @@ | ||
module Haskell.Law.Applicative.IO where | ||
|
||
open import Haskell.Prim | ||
open import Haskell.Prim.IO | ||
|
||
open import Haskell.Prim.Applicative | ||
|
||
open import Haskell.Law.Applicative.Def | ||
|
||
open import Haskell.Law.Functor.IO | ||
|
||
instance postulate iLawfulApplicativeIO : IsLawfulApplicative IO |
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,10 @@ | ||
module Haskell.Law.Functor.IO where | ||
|
||
open import Haskell.Prim | ||
open import Haskell.Prim.IO | ||
|
||
open import Haskell.Prim.Functor | ||
|
||
open import Haskell.Law.Functor.Def | ||
|
||
instance postulate isLawFulFunctorIO : IsLawfulFunctor IO |
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,12 @@ | ||
module Haskell.Law.Monad.IO where | ||
|
||
open import Haskell.Prim | ||
open import Haskell.Prim.IO | ||
|
||
open import Haskell.Prim.Monad | ||
|
||
open import Haskell.Law.Monad.Def | ||
|
||
open import Haskell.Law.Applicative.IO | ||
|
||
instance postulate iLawfulMonadIO : IsLawfulMonad IO |
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
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,27 @@ | ||
module Haskell.Prim.IO where | ||
|
||
open import Haskell.Prim | ||
open import Haskell.Prim.Show | ||
open import Haskell.Prim.String | ||
|
||
postulate IO : ∀{a} → Set a → Set a | ||
|
||
FilePath = String | ||
|
||
postulate | ||
-- Input functions | ||
interact : (String → String) → IO ⊤ | ||
getContents : IO String | ||
getLine : IO String | ||
getChar : IO Char | ||
|
||
-- Output functions | ||
print : ⦃ Show a ⦄ → a → IO ⊤ | ||
putChar : Char → IO ⊤ | ||
putStr : String → IO ⊤ | ||
putStrLn : String → IO ⊤ | ||
|
||
-- Files | ||
readFile : FilePath → IO String | ||
writeFile : FilePath → String → IO ⊤ | ||
appendFile : FilePath → String → IO ⊤ |
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
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,13 @@ | ||
module IOFile where | ||
|
||
open import Haskell.Prelude | ||
|
||
main : IO ⊤ | ||
main = do file ← readFile "IOFile.agda" | ||
writeFile "IOFile2.agda" file | ||
appendFile "IOFile2.agda" "-- Written by appendFile" | ||
file2 ← readFile "IOFile2.agda" | ||
print file2 | ||
return tt | ||
|
||
{-# COMPILE AGDA2HS main #-} |
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,11 @@ | ||
module IOInput where | ||
|
||
open import Haskell.Prelude | ||
|
||
main : IO ⊤ | ||
main = do putStrLn "Write something " | ||
x ← getLine | ||
putStr $ "You wrote: " ++ x | ||
return tt | ||
|
||
{-# COMPILE AGDA2HS main #-} |
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,11 @@ | ||
module IOFile where | ||
|
||
main :: IO () | ||
main | ||
= do file <- readFile "IOFile.agda" | ||
writeFile "IOFile2.agda" file | ||
appendFile "IOFile2.agda" "-- Written by appendFile" | ||
file2 <- readFile "IOFile2.agda" | ||
print file2 | ||
return () | ||
|
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,9 @@ | ||
module IOInput where | ||
|
||
main :: IO () | ||
main | ||
= do putStrLn "Write something " | ||
x <- getLine | ||
putStr $ "You wrote: " ++ x | ||
return () | ||
|