IO.agda 704 B

1234567891011121314151617181920212223
  1. module IO where
  2. open import Base
  3. postulate
  4. IO : Set -> Set
  5. getLine : IO String
  6. putStrLn : String -> IO Unit
  7. mapM₋ : {A : Set} -> (A -> IO Unit) -> List A -> IO Unit
  8. bindIO : {A B : Set} -> IO A -> (A -> IO B) -> IO B
  9. returnIO : {A : Set} -> A -> IO A
  10. {-# COMPILED putStrLn putStrLn #-}
  11. {-# COMPILED mapM₋ (\_ -> mapM_ :: (a -> IO ()) -> [a] -> IO ()) #-}
  12. -- we need to throw away the type argument to mapM_
  13. -- and resolve the overloading explicitly (since Alonzo
  14. -- output is sprinkled with unsafeCoerce#).
  15. {-# COMPILED bindIO (\_ _ -> (>>=) :: IO a -> (a -> IO b) -> IO b) #-}
  16. {-# COMPILED returnIO (\_ -> return :: a -> IO a) #-}
  17. {-# COMPILED getLine getLine #-}