diff options
Diffstat (limited to 'autotypes/app')
-rw-r--r-- | autotypes/app/Main.hs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/autotypes/app/Main.hs b/autotypes/app/Main.hs new file mode 100644 index 0000000..d9fa7f4 --- /dev/null +++ b/autotypes/app/Main.hs @@ -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) + ) + ) + ) |