From d29d951cf8c5558511830a85bb91ab030711b7e7 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 17 Dec 2024 20:34:31 +0100 Subject: ignore nulls in types --- autotypes/src/AutoTypes.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'autotypes/src/AutoTypes.hs') diff --git a/autotypes/src/AutoTypes.hs b/autotypes/src/AutoTypes.hs index ddc948c..493fe11 100644 --- a/autotypes/src/AutoTypes.hs +++ b/autotypes/src/AutoTypes.hs @@ -6,6 +6,7 @@ where import qualified AutoTypes.Unify as U import Data.Aeson (Value, decodeFileStrict', encode) +import Data.Maybe import Data.Maybe (fromJust) import System.Environment (getArgs) import System.FilePath (takeFileName) @@ -17,7 +18,7 @@ autoTypes fp fps = autoTypes' <$> go fp <*> mapM go (fp : fps) autoTypes' :: Value -> [Value] -> U.T autoTypes' t' ts' = - let types = map U.fromJson (t' : ts') + let types = mapMaybe U.fromJson (t' : ts') in head ( foldr1 (\ls rs -> (concat [U.unify1 l r | l <- ls, r <- rs])) -- cgit v1.2.3