on master help sign in
Add primitive for stdout, stderr
0bb1294Edwin Brady
libs/prelude/Prelude.idr+8
@@ -478,6 +478,14 @@ data File = FHandle Ptr
478partial stdin : File
478partial stdin : File
479stdin = FHandle prim__stdin
479stdin = FHandle prim__stdin
480
480
481+||| Standard output
482+partial stdout : File
483+stdout = FHandle prim__stdout
484+
485+||| Standard output
486+partial stderr : File
487+stderr = FHandle prim__stderr
488+
481||| Call the RTS's file opening function
489||| Call the RTS's file opening function
482do_fopen : String -> String -> IO Ptr
490do_fopen : String -> String -> IO Ptr
483do_fopen f m
491do_fopen f m
src/Idris/Primitives.hs+4
@@ -170,6 +170,10 @@ primitives =
170 -- Streams
170 -- Streams
171 Prim (sUN "prim__stdin") (ty [] PtrType) 0 (p_cantreduce)
171 Prim (sUN "prim__stdin") (ty [] PtrType) 0 (p_cantreduce)
172 (0, LStdIn) partial,
172 (0, LStdIn) partial,
173+ Prim (sUN "prim__stdout") (ty [] PtrType) 0 (p_cantreduce)
174+ (0, LStdOut) partial,
175+ Prim (sUN "prim__stderr") (ty [] PtrType) 0 (p_cantreduce)
176+ (0, LStdErr) partial,
173 Prim (sUN "prim__null") (ty [] PtrType) 0 (p_cantreduce)
177 Prim (sUN "prim__null") (ty [] PtrType) 0 (p_cantreduce)
174 (0, LNullPtr) total,
178 (0, LNullPtr) total,
175 -- Managed pointer registration
179 -- Managed pointer registration