on master help sign in
add system to Effects.System as is
commit81a1dde6d417fe16d2843ea46c9c00b54b5c132c authorHeather <heather@live.ru> dateFri 27 Jun 2014, 14:26 (12 years ago) parenta3ccdef
1 file changed+5
libs/effects/Effect/System.idr+5
libs/effects/Effect/System.idr+5
@@ -11,16 +11,19 @@ data System : Effect where
1111 Args : { () } System (List String)
1212 Time : { () } System Int
1313 GetEnv : String -> { () } System (Maybe String)
14+ CSystem : String -> { () } System Int
1415
1516instance Handler System IO where
1617 handle () Args k = do x <- getArgs; k x ()
1718 handle () Time k = do x <- time; k x ()
1819 handle () (GetEnv s) k = do x <- getEnv s; k x ()
20+ handle () (CSystem s) k = do x <- system s; k x ()
1921
2022instance Handler System (IOExcept a) where
2123 handle () Args k = do x <- ioe_lift getArgs; k x ()
2224 handle () Time k = do x <- ioe_lift time; k x ()
2325 handle () (GetEnv s) k = do x <- ioe_lift $ getEnv s; k x ()
26+ handle () (CSystem s) k = do x <- ioe_lift $ system s; k x ()
2427
2528--- The Effect and associated functions
2629
@@ -36,3 +39,5 @@ time = call Time
3639getEnv : Handler System e => String -> { [SYSTEM] } Eff e (Maybe String)
3740getEnv s = call $ GetEnv s
3841
42+system : Handler System e => String -> { [SYSTEM] } Eff e Int
43+system s = call $ CSystem s