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/app/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'autotypes/app/Main.hs') diff --git a/autotypes/app/Main.hs b/autotypes/app/Main.hs index d9fa7f4..5ebb30d 100644 --- a/autotypes/app/Main.hs +++ b/autotypes/app/Main.hs @@ -3,6 +3,7 @@ module Main where import AutoTypes.Unify as U import Data.Aeson (Value, decodeFileStrict', encode) import qualified Data.ByteString.Lazy as B +import Data.Maybe import System.Environment (getArgs) import System.FilePath (takeFileName) @@ -10,7 +11,7 @@ main :: IO () main = do filePaths <- getArgs types <- - mapM + mapMaybeM ( \filePath -> do Just value <- decodeFileStrict' filePath pure (U.fromJson value) @@ -25,3 +26,5 @@ main = do ) ) ) + +mapMaybeM = (fmap catMaybes .) . mapM -- cgit v1.2.3