UniversePolymorphicIO.agda 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {-# OPTIONS --universe-polymorphism #-}
  2. module UniversePolymorphicIO where
  3. open import Common.Level
  4. postulate
  5. IO : ∀ {ℓ} → Set ℓ → Set ℓ
  6. {-# FOREIGN GHC import qualified UniversePolymorphicIO #-}
  7. {-# COMPILE GHC IO = type UniversePolymorphicIO.AgdaIO #-}
  8. {-# BUILTIN IO IO #-}
  9. postulate
  10. return : ∀ {a} {A : Set a} → A → IO A
  11. _>>=_ : ∀ {a b} {A : Set a} {B : Set b} → IO A → (A → IO B) → IO B
  12. postulate
  13. String : Set
  14. {-# BUILTIN STRING String #-}
  15. {-# COMPILE GHC return = \_ _ -> return :: a -> IO a #-}
  16. {-# COMPILE GHC _>>=_ = \_ _ _ _ -> (>>=) :: IO a -> (a -> IO b) -> IO b #-}
  17. {-# FOREIGN GHC import qualified Data.Text.IO #-}
  18. postulate
  19. Unit : Set
  20. putStrLn : String → IO Unit
  21. {-# COMPILE GHC Unit = type () #-}
  22. {-# COMPILE GHC putStrLn = Data.Text.IO.putStrLn #-}
  23. data List (A : Set) : Set where
  24. [] : List A
  25. _∷_ : A → List A → List A
  26. {-# BUILTIN LIST List #-}
  27. main = putStrLn "ok" >>= λ _ → return lzero