From fb7a0716c535c9bf175118176199221d85ceabaf Mon Sep 17 00:00:00 2001 From: Lukasz Czajka Date: Thu, 22 Feb 2024 16:51:46 +0100 Subject: [PATCH] cli options --- app/CommonOptions.hs | 2 +- app/GlobalOptions.hs | 2 +- src/Juvix/Data/Field.hs | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/CommonOptions.hs b/app/CommonOptions.hs index 281a5b7c49..46e5f244eb 100644 --- a/app/CommonOptions.hs +++ b/app/CommonOptions.hs @@ -118,7 +118,7 @@ fieldSizeOpt = eitherReader aux aux :: String -> Either String (Maybe Natural) aux s = case s of "cairo" -> Right $ Just cairoFieldSize - "small" -> Right $ Just defaultFieldSize + "small" -> Right $ Just smallFieldSize _ -> mapRight Just $ either Left checkAllowed $ diff --git a/app/GlobalOptions.hs b/app/GlobalOptions.hs index 11730f8c7f..7f808a9731 100644 --- a/app/GlobalOptions.hs +++ b/app/GlobalOptions.hs @@ -121,7 +121,7 @@ parseGlobalFlags = do fieldSizeOpt ( long "field-size" <> value Nothing - <> help "Field type size [cairo,small,11]" + <> help "Field type size [cairo,small,11] (default: small)" ) _globalUnrollLimit <- option diff --git a/src/Juvix/Data/Field.hs b/src/Juvix/Data/Field.hs index b31c4aacd2..3d84cb306a 100644 --- a/src/Juvix/Data/Field.hs +++ b/src/Juvix/Data/Field.hs @@ -15,14 +15,17 @@ newtype FField = FField makeLenses ''FField +defaultFieldSize :: Natural +defaultFieldSize = smallFieldSize + cairoFieldSize :: Natural cairoFieldSize = 3618502788666131213697322783095070105623107215331596699973092056135872020481 -defaultFieldSize :: Natural -defaultFieldSize = 2147483647 +smallFieldSize :: Natural +smallFieldSize = 2147483647 allowedFieldSizes :: [Natural] -allowedFieldSizes = [11, defaultFieldSize, cairoFieldSize] +allowedFieldSizes = [11, smallFieldSize, cairoFieldSize] instance Serialize FField where put f = S.put (fieldSize f, fieldToInteger f)