This commit is contained in:
Alexander Foremny
2024-05-28 22:04:34 +02:00
commit ec0ea18486
16 changed files with 821 additions and 0 deletions

27
autotypes/app/Main.hs Normal file
View File

@@ -0,0 +1,27 @@
module Main where
import AutoTypes.Unify as U
import Data.Aeson (Value, decodeFileStrict', encode)
import qualified Data.ByteString.Lazy as B
import System.Environment (getArgs)
import System.FilePath (takeFileName)
main :: IO ()
main = do
filePaths <- getArgs
types <-
mapM
( \filePath -> do
Just value <- decodeFileStrict' filePath
pure (U.fromJson value)
)
filePaths
B.putStr
( encode
( head
( foldr1
(\ls rs -> (concat [unify1 l r | l <- ls, r <- rs]))
(map (: []) types)
)
)
)