Issue3732.agda 961 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- Andreas, 2019-05-03, issue #3732
  2. --
  3. -- Do not erase constructor arguments when bound to Haskell data type.
  4. -- Otherwise, it is not predictable how the Haskell constructors should look like.
  5. -- {-# OPTIONS -v compile:100 #-}
  6. open import Agda.Builtin.IO
  7. open import Agda.Builtin.Unit
  8. {-# FOREIGN GHC data I = Bar #-}
  9. {-# FOREIGN GHC data S = Foo I #-}
  10. module NonMutual where
  11. data I : Set where
  12. bar : I
  13. {-# COMPILE GHC I = data I (Bar) #-}
  14. data S : Set where
  15. foo : (i : I) → S
  16. {-# COMPILE GHC S = data S (Foo) #-}
  17. -- It could be that an earlier type embeds a later type, by virtue of mutual blocks:
  18. {-# FOREIGN GHC data I2 = Bar2 #-}
  19. {-# FOREIGN GHC data S2 = Foo2 I2 #-}
  20. module Mutual where
  21. mutual
  22. data S : Set where
  23. foo : (i : I) → S
  24. {-# COMPILE GHC S = data S2 (Foo2) #-}
  25. data I : Set where
  26. bar : I
  27. {-# COMPILE GHC I = data I2 (Bar2) #-}
  28. postulate
  29. main : IO ⊤
  30. {-# COMPILE GHC main = return () #-}