diff options
author | 2024-12-17 20:34:31 +0100 | |
---|---|---|
committer | 2025-02-19 18:09:41 +0100 | |
commit | d29d951cf8c5558511830a85bb91ab030711b7e7 (patch) | |
tree | 88fa48bad69815b7e2a30cb9de3393343c555c6c /autotypes/app/Main.hs | |
parent | fe07f05b8e4f0c7e6eec2714ee1ed5a67b227eda (diff) |
ignore nulls in types
Diffstat (limited to 'autotypes/app/Main.hs')
-rw-r--r-- | autotypes/app/Main.hs | 5 |
1 files changed, 4 insertions, 1 deletions
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 |