Issue1168.hs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. {-# LANGUAGE ScopedTypeVariables #-}
  2. module Main where
  3. ------------------------------------------------------------------------------
  4. -- Haskell imports
  5. import Control.Monad.IO.Class ( MonadIO(liftIO) )
  6. import System.Exit ( exitSuccess )
  7. ------------------------------------------------------------------------------
  8. -- Agda library imports
  9. import Agda.Interaction.FindFile ( SourceFile(..), findInterfaceFile' )
  10. import Agda.Interaction.Imports ( readInterface )
  11. import Agda.Interaction.Options ( defaultOptions )
  12. import Agda.TypeChecking.Monad.Base ( Interface, runTCMTop, TCErr )
  13. import Agda.TypeChecking.Monad.Options ( setCommandLineOptions )
  14. import Agda.Utils.FileName
  15. import Agda.Utils.Impossible
  16. import Agda.Utils.Maybe
  17. ------------------------------------------------------------------------------
  18. main :: IO ()
  19. main = do
  20. r :: Either TCErr (Maybe Interface) <- liftIO $ runTCMTop $
  21. do setCommandLineOptions defaultOptions
  22. src <- liftIO $ SourceFile <$> absolute "Issue1168.agda"
  23. ifile <- findInterfaceFile' src
  24. readInterface $ fromMaybe __IMPOSSIBLE__ ifile
  25. case r of
  26. Right (Just _) -> exitSuccess
  27. -- This case can occurs because:
  28. --
  29. -- a) there is an issue with the Agda interface files or
  30. --
  31. -- b) the Agda versions used for compiling Issue1168.hs and
  32. -- type-checking Issue1168.agda are different,
  33. --
  34. -- c) there is a .agda/default file but there is not a
  35. -- .agda/libraries-XYZ file.
  36. Right Nothing -> error "Nothing"
  37. -- Impossible.
  38. Left _ -> error "Left"