git.iko.soy/typeable/schematic
on master help sign in
fix: werror
commitf4e8e6d94238df4364fc8e0fbfe36bcee7de1fa3 authorNikita <anisimoff.nikita@gmail.com> dateThu 14 Feb 2019, 13:38 (8 years ago) parentae6719f
7 files changed+16−64
src/Data/Schematic/Generator.hs+2−14 src/Data/Schematic/Generator/Regex.hs+4−13 src/Data/Schematic/Path.hs−1 src/Data/Schematic/Verifier/Array.hs−8 src/Data/Schematic/Verifier/Common.hs+2−2 src/Data/Schematic/Verifier/Number.hs−9 src/Data/Schematic/Verifier/Text.hs+8−17
src/Data/Schematic/Generator.hs+2−14
@@ -1,26 +1,14 @@
11module Data.Schematic.Generator where
22
3−import Control.Monad
4−import Data.Aeson (Object, Value(..))
5−import Data.HashMap.Lazy (HashMap)
3+import Data.Aeson (Value(..))
64import qualified Data.HashMap.Lazy as H
7−import Data.List
85import Data.Maybe
9−import Data.Monoid
106import Data.Schematic.Schema
11−import qualified Data.Set as S
12−import Data.Text (Text, pack, unpack)
13−import qualified Data.Text as T (replicate)
14−import Data.Text.Lazy (toStrict)
15−import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
7+import Data.Text (Text, pack)
168import qualified Data.Vector as V
179import Data.Schematic.Generator.Regex
1810import Data.Schematic.Verifier
19−import Test.SmallCheck
2011import Test.SmallCheck.Series
21−import Text.Regex.TDFA
22−import Text.Regex.TDFA.Pattern
23−import Text.Regex.TDFA.ReadRegex (parseRegex)
2412
2513maxHigh :: Int
2614maxHigh = 30
src/Data/Schematic/Generator/Regex.hs+4−13
@@ -1,24 +1,15 @@
11module Data.Schematic.Generator.Regex where
22
33import Control.Monad
4−import Data.Aeson (Object, Value(..))
5−import Data.HashMap.Lazy (HashMap)
6−import qualified Data.HashMap.Lazy as H
74import Data.List
85import Data.Maybe
9−import Data.Monoid
10−import Data.Schematic.Schema
116import qualified Data.Set as S
12−import Data.Text (Text, pack, unpack)
7+import Data.Text (Text, unpack)
138import Data.Text.Lazy (toStrict)
149import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
15−import qualified Data.Vector as V
16−import Test.SmallCheck
1710import Test.SmallCheck.Series
18−import Text.Regex.TDFA
1911import Text.Regex.TDFA.Pattern
2012import Text.Regex.TDFA.ReadRegex (parseRegex)
21−import Data.Schematic.Verifier
2213
2314
2415minRepeat :: Int
@@ -34,8 +25,8 @@ regexSeries regexp =
3425 Left _ -> pure ""
3526
3627regexSeries' :: (Monad m) => Pattern -> Series m Builder
37−regexSeries' p =
38− case p of
28+regexSeries' pt =
29+ case pt of
3930 PEmpty -> pure mempty
4031 PChar {..} -> pure $ singleton getPatternChar
4132 PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> do
@@ -82,4 +73,4 @@ regexSeries' p =
8273 'D' -> notChars $ ['0' .. '9']
8374 'W' -> notChars $ ['0' .. '9'] ++ '_' : ['a' .. 'z'] ++ ['A' .. 'Z']
8475 'S' -> notChars "\9\32"
85− ch -> [ch]
76+ ch' -> [ch']
src/Data/Schematic/Path.hs−1
@@ -1,7 +1,6 @@
11module Data.Schematic.Path where
22
33import Data.Foldable as F
4−import Data.Monoid
54import Data.Singletons.Prelude
65import Data.Singletons.TypeLits
76import Data.Text as T
src/Data/Schematic/Verifier/Array.hs−8
@@ -1,15 +1,7 @@
11module Data.Schematic.Verifier.Array where
22
3−import Data.List
4−import Data.Maybe
53import Data.Schematic
64import Data.Schematic.Verifier.Common
7−import Data.Singletons
8−import Data.Singletons.Prelude
9−import Data.Singletons.TypeLits
10−import Data.Text (Text)
11−import Data.Text.Array (Array)
12−import GHC.Generics
135
146data VerifiedArrayConstraint =
157 VAEq Integer
src/Data/Schematic/Verifier/Common.hs+2−2
@@ -18,8 +18,8 @@ verifyDNEq :: [Integer] -> Maybe (Maybe Integer)
1818verifyDNEq x =
1919 case nub x of
2020 [] -> Just Nothing
21− [x] -> Just $ Just x
22− (x:y:_) -> Nothing
21+ [y] -> Just $ Just y
22+ (_:_:_) -> Nothing
2323
2424verify3 :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe ()
2525verify3 (Just x) (Just y) (Just z) =
src/Data/Schematic/Verifier/Number.hs−9
@@ -1,16 +1,7 @@
11module Data.Schematic.Verifier.Number where
22
3−import Data.List
4−import Data.Maybe
53import Data.Schematic
6−import Data.Schematic.Schema
74import Data.Schematic.Verifier.Common
8−import Data.Singletons
9−import Data.Singletons.Prelude
10−import Data.Singletons.TypeLits
11−import Data.Text (Text)
12−import Data.Text.Array (Array)
13−import GHC.Generics
145
156toStrictNumber :: [DemotedNumberConstraint] -> [DemotedNumberConstraint]
167toStrictNumber = map f
src/Data/Schematic/Verifier/Text.hs+8−17
@@ -1,19 +1,10 @@
11module Data.Schematic.Verifier.Text where
22
33import Control.Monad
4−import Data.List
54import Data.Maybe
65import Data.Schematic
7−import Data.Schematic.Schema
86import Data.Schematic.Verifier.Common
9−import Data.Singletons
10−import Data.Singletons.Prelude
11−import Data.Singletons.TypeLits
12−import Data.Text (unpack)
13−import Data.Text (Text)
14−import Data.Text.Array (Array)
15−import GHC.Generics
16−import Text.Regex.TDFA
7+import Data.Text (Text, unpack)
178import Text.Regex.TDFA.Pattern
189import Text.Regex.TDFA.ReadRegex (parseRegex)
1910
@@ -62,12 +53,12 @@ minRegexLength p =
6253 case p of
6354 PEmpty -> 0
6455 PChar {..} -> 1
65− PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> 1
66− PAnyNot {getPatternSet = PatternSet (Just cset) _ _ _} -> 1
67− PQuest p -> 0
68− PPlus p -> minRegexLength $ PBound 1 Nothing p
69− PStar _ p -> minRegexLength $ PBound 0 Nothing p
70− PBound low mhigh p -> low * minRegexLength p
56+ PAny {..} -> 1
57+ PAnyNot {..} -> 1
58+ PQuest _ -> 0
59+ PPlus sch -> minRegexLength $ PBound 1 Nothing sch
60+ PStar _ sch -> minRegexLength $ PBound 0 Nothing sch
61+ PBound low _ sch -> low * minRegexLength sch
7162 PConcat ps -> sum $ fmap minRegexLength ps
7263 POr xs -> minimum $ fmap minRegexLength xs
7364 PDot _ -> 1
@@ -86,7 +77,7 @@ maxRegexLength p =
8677 PQuest _ -> Just 0
8778 PPlus _ -> Nothing
8879 PStar _ _ -> Nothing
89− PBound low mhigh p -> (*) <$> mhigh <*> maxRegexLength p
80+ PBound _ mhigh sch -> (*) <$> mhigh <*> maxRegexLength sch
9081 PConcat ps -> sum <$> mapM maxRegexLength ps
9182 POr xs -> maximum <$> mapM maxRegexLength xs
9283 PDot _ -> Just 1