packages feed

cli-arguments-strict (empty) → 0.1.0.0

raw patch · 9 files changed

+602/−0 lines, 9 filesdep +basesetup-changed

Dependencies added: base

Files

+ CHANGELOG.md view
@@ -0,0 +1,6 @@+# Revision history for cli-arguments-strict++## 0.1.0.0 -- 2022-01-12++* First version. Released on an unsuspecting world as the strict versions +of the cli-arguments-0.6.0.0 package functionality.
+ CLI/Arguments/Arr/Strict.hs view
@@ -0,0 +1,125 @@+{-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE StrictData, Strict #-}+-- |+-- Module      :  CLI.Arguments.Arr.Strict+-- Copyright   :  (c) OleksandrZhabenko 2021-2022+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- A library to process command line arguments in some more convenient way.++module CLI.Arguments.Arr.Strict where++import GHC.Arr+import Data.List (sortBy)+import CLI.Arguments.Strict+import CLI.Arguments.Parsing.Strict+import CLI.Arguments.Sorted.Strict++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeABCsArr+  :: (CLSpecifications -> [String] -> Args) -- ^ A function to collect the 'Args'+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeABCsArr f ts xss = listArray (0,l-1) js+     where js = f ts xss+           l = length js+{-# INLINABLE takeABCsArr #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeCsArr+  :: CLSpecifications+  -> [String]+  -> Array Int Arguments+takeCsArr = takeABCsArr (\us zss -> fst . takeCsR us $ zss)+{-# INLINABLE takeCsArr #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeCs1Arr+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeCs1Arr (x1,x2) = takeABCsArr (\us zss -> fst . takeCs1R (x1,x2) us $ zss)+{-# INLINABLE takeCs1Arr #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeBsArr+  :: CLSpecifications+  -> [String]+  -> Array Int Arguments+takeBsArr = takeABCsArr (\us zss -> fst . takeBsR us $ zss)+{-# INLINABLE takeBsArr #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeAsArr+  :: CLSpecifications+  -> [String]+  -> Array Int Arguments+takeAsArr  = takeABCsArr (\us zss -> fst . takeAsR us $ zss)+{-# INLINABLE takeAsArr #-}++---------------------------------------------------++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeABCsArrSortedBy+  :: ((Arguments -> Arguments -> Ordering) -> CLSpecifications -> [String] -> Args)+  -> (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeABCsArrSortedBy g f ts xss = listArray (0,l-1) js+     where js = g f  ts xss+           l = length js+{-# INLINABLE takeABCsArrSortedBy #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeCsArrSortedBy+  :: (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeCsArrSortedBy = takeABCsArrSortedBy (takeArgsSortedBy (\x -> notNullArguments x && isC x))+{-# INLINABLE takeCsArrSortedBy #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeCs1ArrSortedBy+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification being also the first character.+  -> (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeCs1ArrSortedBy (x1,x2) = takeABCsArrSortedBy (takeArgs1SortedBy (x1,x2) (\x -> notNullArguments x && isC x))+{-# INLINABLE takeCs1ArrSortedBy #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeBsArrSortedBy+  :: (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'B's.+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeBsArrSortedBy = takeABCsArrSortedBy (takeArgsSortedBy (\x -> notNullArguments x && isB x))+{-# INLINABLE takeBsArrSortedBy #-}++-- | For empty list of 'String's returns empty array that has no elements. Trying to index it always returns error and can cause+-- segmentation fault in the running program or interpreter (GHCi).+takeAsArrSortedBy+  :: (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'A's.+  -> CLSpecifications+  -> [String]+  -> Array Int Arguments+takeAsArrSortedBy = takeABCsArrSortedBy (takeArgsSortedBy (\x -> notNullArguments x && isA x))+{-# INLINABLE takeAsArrSortedBy #-}++
+ CLI/Arguments/Get/Strict.hs view
@@ -0,0 +1,83 @@+{-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE StrictData, Strict #-}+-- |+-- Module      :  CLI.Arguments.Get.Strict+-- Copyright   :  (c) OleksandrZhabenko 2022+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- A library to process command line arguments in some more convenient way.++module CLI.Arguments.Get.Strict where++import Data.Maybe (fromJust)+import qualified Data.Foldable as F+import CLI.Arguments.Strict++oneA+ :: (F.Foldable t) => String -> t Arguments -> Bool+oneA xs ys = F.any (\(A ts) -> ts == xs) ys++oneB+ :: (F.Foldable t) => String -> t Arguments -> Bool+oneB xs ys = F.any (\(B _ zs _) -> zs == xs) ys++oneC+ :: (F.Foldable t) => String -> t Arguments -> Bool+oneC xs ys = F.any (\(C zs _) -> zs == xs) ys++listA+ :: (F.Foldable t) => [String] -> t Arguments -> Bool+listA xss ys+  | null xss = False+  | otherwise = F.any (\(A ts) -> ts `elem` xss) ys++listB+ :: (F.Foldable t) => [String] -> t Arguments -> Bool+listB xss ys+  | null xss = False+  | otherwise = F.any (\(B _ zs _) -> zs `elem` xss) ys++listC+ :: (F.Foldable t) => [String] -> t Arguments -> Bool+listC xss ys+  | null xss = False+  | otherwise = F.any (\(C zs _) -> zs `elem` xss) ys++getA+ :: (F.Foldable t) => String -> t Arguments -> String+getA xs ys+  | oneA xs ys = (\(A ts) -> ts) . fromJust . F.find (\(A rs) -> rs == xs) $ ys+  | otherwise = []++getB+ :: (F.Foldable t) => String -> t Arguments -> [String]+getB xs ys+  | oneB xs ys =  (\(B _ _ yss) -> yss) . fromJust . F.find (\(B _ zs _) -> zs == xs) $ ys+  | otherwise = []++getC+ :: (F.Foldable t) => String -> t Arguments -> [String]+getC xs ys+  | oneC xs ys = (\(C _ yss) -> yss) . fromJust . F.find (\(C zs _) -> zs == xs) $ ys+  | otherwise = []++getLstA+ :: (F.Foldable t) => [String] -> t Arguments -> [String]+getLstA xss ys+  | listA xss ys = filter (not . null) . map (\xs -> getA xs ys) $ xss+  | otherwise = []++getLstB+ :: (F.Foldable t) => [String] -> t Arguments -> [[String]]+getLstB xss ys+  | listB xss ys = filter (not . null) . map (\xs -> getB xs ys) $ xss+  | otherwise = []++getLstC+ :: (F.Foldable t) => [String] -> t Arguments -> [[String]]+getLstC xss ys+  | listC xss ys = filter (not . null) . map (\xs -> getC xs ys) $ xss+  | otherwise = []+
+ CLI/Arguments/Parsing/Strict.hs view
@@ -0,0 +1,197 @@+{-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE StrictData, Strict #-}+-- |+-- Module      :  CLI.Arguments.Parsing.Strict+-- Copyright   :  (c) OleksandrZhabenko 2022+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- A library to process command line arguments in some more convenient way.++module CLI.Arguments.Parsing.Strict where++import Data.Monoid (mappend)+import Data.Maybe (fromJust)+import GHC.Arr+import Data.List (sortBy)+import qualified Data.Foldable as F+import CLI.Arguments.Strict++args2ArgsR+  :: CLSpecifications+  -> (Args,[String])+  -> (Args,[String])+args2ArgsR ((t@(xs,n)):ms) q@(ls,xss@(js:jss))+  | n < 0 = case w0ss of+             [] -> args2ArgsR ms q+             w00ss -> case qss of+                       [] -> args2ArgsR ms q+                       q0ss -> args2ArgsR ms (C xs q0ss:ls,kss `mappend` rss)+  | n == 0 = case w0ss of+              [] -> args2ArgsR ms q+              w00ss -> args2ArgsR ms (A xs:ls,kss `mappend` wss)+  | otherwise = case w0ss of+                 [] -> args2ArgsR ms q+                 w00ss -> if length vss == n then args2ArgsR ms (B n xs vss:ls,kss `mappend` zss)+                          else args2ArgsR ms q+      where (kss,uss) = break (== xs) xss+            (w0ss,wss) = splitAt 1 uss+            (qss,pss) = break (== xs) wss+            (r0ss,rss) = splitAt 1 pss+            (vss,zss) = splitAt n wss+args2ArgsR _ q = q++args2ArgsR0+  :: CLSpecifications+  -> [String]+  -> (Args,[String])+args2ArgsR0 xs yss = args2ArgsR xs ([],yss)+{-# INLINABLE args2ArgsR0 #-}++args2Args3'R+  :: CLSpecifications+  -> (Args,Args,Args,[String])+  -> (Args,Args,Args,[String])+args2Args3'R (t@(xs,n):ts) q@(w1,w2,w3,xss@(js:jss))+  | n < 0 = case w0ss of+             [] -> args2Args3'R ts q+             w00ss -> case qss of+                       [] -> args2Args3'R ts q+                       q0ss -> args2Args3'R ts (w1,w2,C xs q0ss:w3,kss `mappend` rss)+  | n == 0 = case w0ss of+              [] -> args2Args3'R ts q+              w00ss -> args2Args3'R ts (A xs:w1,w2,w3,kss `mappend` wss)+  | otherwise = case w0ss of+                 [] -> args2Args3'R ts q+                 w00ss -> if length vss == n then args2Args3'R ts (w1,B n xs vss:w2,w3,kss `mappend` zss)+                          else args2Args3'R ts q+      where (kss,uss) = break (== xs) xss+            (w0ss,wss) = splitAt 1 uss+            (qss,pss) = break (== xs) wss+            (r0ss,rss) = splitAt 1 pss+            (vss,zss) = splitAt n wss+args2Args3'R _ q = q++args2Args3R+  :: CLSpecifications+  -> [String]+  -> (Args,Args,Args,[String])+args2Args3R xs yss = args2Args3'R xs ([],[],[],yss)+{-# INLINABLE args2Args3R #-}++------------------------------------------------------------------------------++args2Args1R+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> CLSpecifications+  -> (Args,[String])+  ->  (Args,[String])+args2Args1R (x1,x2) (t@(xs@(k:ks),n):ts) q@(ls,xss@(js:jss))+  | n < 0 = case w0ss of+             [] -> args2Args1R (x1,x2) ts q+             w00ss -> case qss of+                       [] -> args2Args1R (x1,x2) ts q+                       q0ss -> args2Args1R (x1,x2) ts (C xs qss:ls,kss `mappend` rss)+  | n == 0 = case w0ss of+              [] -> args2Args1R (x1,x2) ts q+              w00ss -> args2Args1R (x1,x2) ts (A xs:ls,kss `mappend` wss)+  | otherwise = case w0ss of+                 [] -> args2Args1R (x1,x2) ts q+                 w00ss -> if length vss == n then args2Args1R (x1,x2) ts (B n xs vss:ls,kss `mappend` zss)+                          else args2Args1R (x1,x2) ts q+      where (kss,uss) = break (== xs) xss+            (w0ss,wss) = splitAt 1 uss+            (qss,pss) = break (\rs -> rs == xs || (k == x1 && rs == (x2:ks))) wss+            (r0ss,rss) = splitAt 1 pss+            (vss,zss) = splitAt n wss+args2Args1R (x1,x2) (t@([],n):ts) q = args2Args1R (x1,x2) ts q+args2Args1R _ _ q = q++args2Args3'1R+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> CLSpecifications+  -> (Args,Args,Args,[String])+  -> (Args,Args,Args,[String])+args2Args3'1R (x1,x2) (t@(xs@(k:ks),n):ts) q@(w1,w2,w3,xss@(js:jss))+  | n < 0 = case w0ss of+             [] -> args2Args3'1R (x1,x2) ts q+             w00ss -> case qss of+                       [] -> args2Args3'1R (x1,x2) ts q+                       q0ss -> args2Args3'1R (x1,x2) ts (w1,w2,C xs q0ss:w3,kss `mappend` rss)+  | n == 0 = case w0ss of+              [] -> args2Args3'1R (x1,x2) ts q+              w00ss -> args2Args3'1R (x1,x2) ts (A xs:w1,w2,w3,kss `mappend` wss)+  | otherwise = case w0ss of+                 [] -> args2Args3'1R (x1,x2) ts q+                 w00ss -> if length vss == n then args2Args3'1R (x1,x2) ts (w1,B n xs vss:w2,w3,kss `mappend` zss)+                          else args2Args3'1R (x1,x2) ts q+      where (kss,uss) = break (== xs) xss+            (w0ss,wss) = splitAt 1 uss+            (qss,pss) = break (\rs -> rs == xs || (k == x1 && rs == (x2:ks))) wss+            (r0ss,rss) = splitAt 1 pss+            (vss,zss) = splitAt n wss+args2Args3'1R (x1,x2) _ q = q++args2Args31R+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> CLSpecifications+  -> [String]+  -> (Args,Args,Args,[String])+args2Args31R (x1,x2) xs yss = args2Args3'1R (x1,x2) xs ([],[],[],yss)+{-# INLINABLE args2Args31R #-}++----------------------------------------------------------------------++-- | This function can actually parse the command line arguments being the ['String'].+args2ArgsFilteredGR+  :: (Arguments -> Bool) -- ^ A predicate to check which 'Arguments' must be kept in the result.+  -> CLSpecifications+  -> (Args,[String])+  -> (Args,[String])+args2ArgsFilteredGR f ts r = (filter f . map b1Args2AArgs $ qs, yss)+  where (qs,yss) = args2ArgsR ts r+{-# INLINABLE args2ArgsFilteredGR #-}++-- | This function can actually parse the command line arguments being the ['String'].+args2ArgsFilteredG1R+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> (Arguments -> Bool) -- ^ A predicate to check which 'Arguments' must be kept in the result.+  -> CLSpecifications+  -> (Args,[String])+  -> (Args,[String])+args2ArgsFilteredG1R (x1,x2) f ts r = (filter f . map b1Args2AArgs $ qs, yss)+  where (qs,yss) = args2Args1R (x1,x2) ts r+{-# INLINABLE args2ArgsFilteredG1R #-}++----------------------------------------------------------------------++takeCsR+  :: CLSpecifications+  -> [String]+  -> (Args,[String])+takeCsR xs yss = args2ArgsFilteredGR (\x -> notNullArguments x && isC x) xs ([],yss)+{-# INLINABLE takeCsR #-}++takeCs1R+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> CLSpecifications+  -> [String]+  -> (Args,[String])+takeCs1R (x1,x2) xs yss = args2ArgsFilteredG1R (x1,x2) (\x -> notNullArguments x && isC x) xs ([],yss)+{-# INLINABLE takeCs1R #-}++takeBsR+  :: CLSpecifications+  -> [String]+  -> (Args,[String])+takeBsR xs yss = args2ArgsFilteredGR (\x -> notNullArguments x && isB x) xs ([],yss)+{-# INLINABLE takeBsR #-}++takeAsR+  :: CLSpecifications+  -> [String]+  -> (Args,[String])+takeAsR xs yss = args2ArgsFilteredGR (\x -> notNullArguments x && isA x) xs ([],yss)+{-# INLINABLE takeAsR #-}+
+ CLI/Arguments/Sorted/Strict.hs view
@@ -0,0 +1,70 @@+{-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE StrictData, Strict #-}+-- |+-- Module      :  CLI.Arguments.Sorted.Strict+-- Copyright   :  (c) OleksandrZhabenko 2021-2022+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- A library to process command line arguments in some more convenient way.++module CLI.Arguments.Sorted.Strict where++import Data.Monoid (mappend)+import Data.Maybe (fromJust)+import Data.List (sortBy)+import CLI.Arguments.Strict+import CLI.Arguments.Parsing.Strict++takeArgsSortedBy+  :: (Arguments -> Bool) -- ^ A predicate to check which 'Arguments' must be kept in the result.+  -> (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Args+takeArgsSortedBy g f ts yss = sortBy f . fst . args2ArgsFilteredGR g ts $ ([],yss)+{-# INLINABLE takeArgsSortedBy #-}++takeArgs1SortedBy+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> (Arguments -> Bool) -- ^ A predicate to check which 'Arguments' must be kept in the result.+  -> (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Args+takeArgs1SortedBy (x1,x2) g f ts yss = sortBy f . fst . args2ArgsFilteredG1R (x1,x2) g ts $ ([],yss)+{-# INLINABLE takeArgs1SortedBy #-}++takeCsSortedBy+  :: (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Args+takeCsSortedBy = takeArgsSortedBy (\x -> notNullArguments x && isC x)+{-# INLINABLE takeCsSortedBy #-}++takeCs1SortedBy+  :: FirstChars -- ^ A pair of the first characters of the starting group delimiter (the same for all 'String's in the all 'CLSpecifications') and the probable its modification (the first character of the last delimiter).+  -> (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'C's.+  -> CLSpecifications+  -> [String]+  -> Args+takeCs1SortedBy (x1,x2) = takeArgs1SortedBy (x1,x2) (\x -> notNullArguments x && isC x)+{-# INLINABLE takeCs1SortedBy #-}++takeBsSortedBy+  :: (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'B's.+  -> CLSpecifications+  -> [String]+  -> Args+takeBsSortedBy = takeArgsSortedBy (\x -> notNullArguments x && isB x)+{-# INLINABLE takeBsSortedBy #-}++takeAsSortedBy+  :: (Arguments -> Arguments -> Ordering) -- ^ A 'compare'-like implementation for 'Arguments'. If needed you can implement your own 'Ord' instance for 'Arguments' and use it here. Here can be partial, just for 'A's.+  -> CLSpecifications+  -> [String]+  -> Args+takeAsSortedBy = takeArgsSortedBy (\x -> notNullArguments x && isA x)+{-# INLINABLE takeAsSortedBy #-}
+ CLI/Arguments/Strict.hs view
@@ -0,0 +1,73 @@+{-# OPTIONS_HADDOCK show-extensions #-}+{-# LANGUAGE StrictData, Strict #-}+-- |+-- Module      :  CLI.Arguments.Strict+-- Copyright   :  (c) OleksandrZhabenko 2021-2022+-- License     :  MIT+-- Stability   :  Experimental+-- Maintainer  :  olexandr543@yahoo.com+--+-- A library to process command line arguments in some more convenient way. +-- If you plan to use it with the cli-arguments functions, please, use the +-- qualified import.++module CLI.Arguments.Strict where++import Data.Monoid (mappend)++data Arguments =+  A String+  | B GQtyArgs Delimiter [String]+  | C Delimiter [String]+      deriving Eq++type Args = [Arguments]++type Specification = (Delimiter,GQtyArgs)++type CLSpecifications = [Specification]++type Delimiter = String++type GQtyArgs = Int++type FirstCharacter = Char++type FirstChars = (Char,Char)++instance Show Arguments where+  show (A xs) = xs+  show (B n ys yss) = ' ':ys `mappend` concatMap (\xs ->' ':show xs) (take n yss)+  show (C xs xss) = ' ':xs `mappend` concatMap (\ys ->' ':show ys) xss `mappend` (' ':xs)++isA :: Arguments -> Bool+isA (A _) = True+isA _ = False++isB :: Arguments -> Bool+isB (B _ _ _) = True+isB _ = False++isC :: Arguments -> Bool+isC (C _ _) = True+isC _ = False++nullArguments :: Arguments -> Bool+nullArguments (A xs) = null xs+nullArguments (B n ys yss) = n /= length yss || null ys  || null yss+nullArguments (C xs xss) = null xs || null xss++notNullArguments :: Arguments -> Bool+notNullArguments (A (_:_)) =  True+notNullArguments (A _) = False+notNullArguments (B n (_:_) yss@(_:_)) = n == length yss+notNullArguments (B _ _ _) = False+notNullArguments (C (_:_) (_:_)) = True+notNullArguments _ = False++b1Args2AArgs :: Arguments -> Arguments+b1Args2AArgs b@(B n _ [ys])+ | n < 1 = A ys+ | otherwise = b+b1Args2AArgs x = x+
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2021-2022 OleksandrZhabenko++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ cli-arguments-strict.cabal view
@@ -0,0 +1,26 @@+cabal-version:       >=1.10+-- Initial package description 'cli-arguments-strict.cabal' generated by 'cabal+-- init'.  For further documentation, see+-- http://haskell.org/cabal/users-guide/++name:                cli-arguments-strict+version:             0.1.0.0+synopsis:            A library to process command line arguments in some more convenient way.+description:         A strict version of the cli-arguments package.+-- bug-reports:+license:             MIT+license-file:        LICENSE+author:              OleksandrZhabenko+maintainer:          olexandr543@yahoo.com+copyright:           Oleksandr Zhabenko+category:            CLI+build-type:          Simple+extra-source-files:  CHANGELOG.md++library+  exposed-modules:     CLI.Arguments.Strict, CLI.Arguments.Parsing.Strict, CLI.Arguments.Arr.Strict, CLI.Arguments.Get.Strict, CLI.Arguments.Sorted.Strict+  -- other-modules:+  -- other-extensions:+  build-depends:       base >=4.9 && <5+  -- hs-source-dirs:+  default-language:    Haskell2010