on master help sign in
Add IOExcept implementation for ST.ConsoleIO
commitea2041c47e20ae62341224ee8b36f680efb646a5 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateMon 5 Jun 2017, 11:51 (9 years ago) parent64c5f70
1 file changed+10−1
libs/contrib/Control/ST.idr+10−1
libs/contrib/Control/ST.idr+10−1
@@ -1,6 +1,7 @@
11module Control.ST
22
33import Language.Reflection.Utils
4+import Control.IOExcept
45
56%default total
67
@@ -571,9 +572,17 @@ ConsoleIO IO where
571572 putStr str = lift (Interactive.putStr str)
572573 getStr = lift Interactive.getLine
573574
574− putChar c = lift $ Interactive.putChar c
575+ putChar c = lift (Interactive.putChar c)
575576 getChar = lift Interactive.getChar
576577
578+export
579+ConsoleIO (IOExcept err) where
580+ putStr str = lift (ioe_lift (Interactive.putStr str))
581+ getStr = lift (ioe_lift Interactive.getLine)
582+
583+ putChar c = lift (ioe_lift (Interactive.putChar c))
584+ getChar = lift (ioe_lift Interactive.getChar)
585+
577586export
578587run : Applicative m => ST m a [] -> m a
579588run prog = runST [] prog (\res, env' => pure res)