[Agda] IO programs examples ?

Sergei Meshveliani mechvel at botik.ru
Fri Jan 26 20:13:45 CET 2018


On Fri, 2018-01-26 at 09:53 +0100, Serge Leblanc wrote:
> 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 
--------------------------------------------------





More information about the Agda mailing list