Discussion:
[Agda] IO programs examples ?
Serge Leblanc
2018-01-26 08:53:13 UTC
Permalink
Hi, does someone have examples of IO programs for reads and writing files ?

Sincere,
--
Serge Leblanc
------------------------------------------------------------------------
gpg --search-keys 0x67B17A3F
Fingerprint = 2B2D AC93 8620 43D3 D2C2 C2D3 B67C F631 67B1 7A3F
Guillaume Allais
2018-01-26 10:02:56 UTC
Permalink
Hi Serge,

Here is a barebones implementation of cat (i.e. a use-case of readFile):
https://github.com/gallais/potpourri/blob/master/agda/poc/😞.agda

Cheers,
--
gallais
Post by Serge Leblanc
Hi, does someone have examples of IO programs for reads and writing files ?
Sincere,
--
Serge Leblanc
------------------------------------------------------------------------
gpg --search-keys 0x67B17A3F
Fingerprint = 2B2D AC93 8620 43D3 D2C2 C2D3 B67C F631 67B1 7A3F
_______________________________________________
Agda mailing list
https://lists.chalmers.se/mailman/listinfo/agda
Sergei Meshveliani
2018-01-26 19:13:45 UTC
Permalink
Post by Serge Leblanc
Hi, does someone have examples of IO programs for reads and writing files ?
Below `main' reads a string from data.txt and writes the obtained
string to standard output:

--------------------------------------------------
module TT where
open import Function using (_∘_)
open import Foreign.Haskell
open import IO.Primitive
open import Data.String using (String; toCostring)

main = (readFiniteFile "data.txt") >>= putStrLn ∘ toCostring ∘ g
where
g : String -> String
g str = str
--------------------------------------------------

Loading...