I've been using Agda for 9 months now. For the first time, I find myself wanting to "run" (as a top-level executable) an Agda program that prints a string. Call me old-fashioned.
I can write a program that computes a string and get Agda to show me the value of the string in interactive mode (or Emacs). But the string is long and has embedded newlines. I would like it actually printed out.
By way of comparison, in GHCi I can do something like this:
Prelude> putStrLn "hello, world!"
hello, world!
But in Agda's interactive mode I get this:
Main> putStrLn "hello, world!"
.IO.♯-15
('h' .Data.Colist.Colist.∷
.Data.Colist.♯-2 'h'
('e' .Data.List.List.∷
'l' .Data.List.List.∷
'l' .Data.List.List.∷
'o' .Data.List.List.∷
',' .Data.List.List.∷
' ' .Data.List.List.∷
'w' .Data.List.List.∷
'o' .Data.List.List.∷
'r' .Data.List.List.∷
'l' .Data.List.List.∷
'd' .Data.List.List.∷ '!' .Data.List.List.∷ .Data.List.List.[]))
>>
.IO.♯-16
('h' .Data.Colist.Colist.∷
.Data.Colist.♯-2 'h'
('e' .Data.List.List.∷
'l' .Data.List.List.∷
'l' .Data.List.List.∷
'o' .Data.List.List.∷
',' .Data.List.List.∷
' ' .Data.List.List.∷
'w' .Data.List.List.∷
'o' .Data.List.List.∷
'r' .Data.List.List.∷
'l' .Data.List.List.∷
'd' .Data.List.List.∷ '!' .Data.List.List.∷ .Data.List.List.[]))
So, how do I take a program like the following and run it so that I observe the effects that have accumulated in the IO
value?
module Temp where
open import Data.Unit
open import IO
main : IO ⊤
main = putStrLn "Hello, world!"
I notice there's a Haskell-style run
function declared in Agda's IO
module, but I haven't found a way to make that help.