Test.hs 866 B

123456789101112131415161718192021222324252627282930313233
  1. module Main where
  2. import Ivory.Artifact
  3. import Control.Monad
  4. import Gidl.Types
  5. import Gidl.Interface
  6. import Gidl.Parse
  7. import Gidl.Schema
  8. import Gidl.Backend.Cabal
  9. import Gidl.Backend.Haskell.Types
  10. import Gidl.Backend.Haskell
  11. main :: IO ()
  12. main = do
  13. test "tests/testtypes.sexpr"
  14. runHaskellBackend "tests/testtypes.sexpr"
  15. "gidl-haskell-backend-test"
  16. (words "Gidl Haskell Test")
  17. "tests/gidl-haskell-backend-test"
  18. test :: FilePath -> IO ()
  19. test f = do
  20. c <- readFile f
  21. case parseDecls c of
  22. Left e -> print e
  23. Right (te@(TypeEnv te'), ie@(InterfaceEnv ie')) -> do
  24. forM_ te' $ \(tn, t) -> do
  25. putStrLn (tn ++ ":")
  26. print (typeLeaves t)
  27. let a = typeModule (words "Sample IDL Haskell Types")
  28. (typeDescrToRepr tn te)
  29. printArtifact a