From ec0ea18486ed2569808f2e511ecac52f812300b0 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 28 May 2024 22:04:34 +0200 Subject: init --- autotypes/app/Main.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 autotypes/app/Main.hs (limited to 'autotypes/app') 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) + ) + ) + ) -- cgit v1.2.3