Test.hs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.Interface
  11. import Gidl.Backend.Haskell
  12. main :: IO ()
  13. main = do
  14. test "tests/testtypes.sexpr"
  15. runHaskellBackend "tests/testtypes.sexpr"
  16. "gidl-haskell-backend-test"
  17. (words "Gidl Haskell Test")
  18. "tests/gidl-haskell-backend-test"
  19. test :: FilePath -> IO ()
  20. test f = do
  21. c <- readFile f
  22. case parseDecls c of
  23. Left e -> putStrLn e
  24. Right (te@(TypeEnv te'), ie@(InterfaceEnv ie')) -> do
  25. {-
  26. forM_ te' $ \(tn, t) -> do
  27. putStrLn (tn ++ ":")
  28. print (typeLeaves t)
  29. let a = typeModule (words "Sample IDL Haskell Types")
  30. (typeDescrToRepr tn te)
  31. printArtifact a
  32. -}
  33. forM_ ie' $ \(iname, _i) -> do
  34. printArtifact $ interfaceModule (words "Sample IDL Haskell Interface")
  35. (interfaceDescrToRepr iname ie te)