git.iko.soy/typeable/schematic
on master help sign in
fix: werror
f4e8e6dNikita
src/Data/Schematic/Generator.hs+2−14
@@ -1,26 +1,14 @@
1module Data.Schematic.Generator where
1module Data.Schematic.Generator where
2
2
3−import Control.Monad
4−import Data.Aeson (Object, Value(..))
3+import Data.Aeson (Value(..))
5−import Data.HashMap.Lazy (HashMap)
6import qualified Data.HashMap.Lazy as H
4import qualified Data.HashMap.Lazy as H
7−import Data.List
8import Data.Maybe
5import Data.Maybe
9−import Data.Monoid
10import Data.Schematic.Schema
6import Data.Schematic.Schema
11−import qualified Data.Set as S
12−import Data.Text (Text, pack, unpack)
7+import Data.Text (Text, pack)
13−import qualified Data.Text as T (replicate)
14−import Data.Text.Lazy (toStrict)
15−import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
16import qualified Data.Vector as V
8import qualified Data.Vector as V
17import Data.Schematic.Generator.Regex
9import Data.Schematic.Generator.Regex
18import Data.Schematic.Verifier
10import Data.Schematic.Verifier
19−import Test.SmallCheck
20import Test.SmallCheck.Series
11import Test.SmallCheck.Series
21−import Text.Regex.TDFA
22−import Text.Regex.TDFA.Pattern
23−import Text.Regex.TDFA.ReadRegex (parseRegex)
24
12
25maxHigh :: Int
13maxHigh :: Int
26maxHigh = 30
14maxHigh = 30
src/Data/Schematic/Generator/Regex.hs+4−13
@@ -1,24 +1,15 @@
1module Data.Schematic.Generator.Regex where
1module Data.Schematic.Generator.Regex where
2
2
3import Control.Monad
3import Control.Monad
4−import Data.Aeson (Object, Value(..))
5−import Data.HashMap.Lazy (HashMap)
6−import qualified Data.HashMap.Lazy as H
7import Data.List
4import Data.List
8import Data.Maybe
5import Data.Maybe
9−import Data.Monoid
10−import Data.Schematic.Schema
11import qualified Data.Set as S
6import qualified Data.Set as S
12−import Data.Text (Text, pack, unpack)
7+import Data.Text (Text, unpack)
13import Data.Text.Lazy (toStrict)
8import Data.Text.Lazy (toStrict)
14import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
9import Data.Text.Lazy.Builder (Builder, singleton, toLazyText)
15−import qualified Data.Vector as V
16−import Test.SmallCheck
17import Test.SmallCheck.Series
10import Test.SmallCheck.Series
18−import Text.Regex.TDFA
19import Text.Regex.TDFA.Pattern
11import Text.Regex.TDFA.Pattern
20import Text.Regex.TDFA.ReadRegex (parseRegex)
12import Text.Regex.TDFA.ReadRegex (parseRegex)
21−import Data.Schematic.Verifier
22
13
23
14
24minRepeat :: Int
15minRepeat :: Int
@@ -34,8 +25,8 @@ regexSeries regexp =
34 Left _ -> pure ""
25 Left _ -> pure ""
35
26
36regexSeries' :: (Monad m) => Pattern -> Series m Builder
27regexSeries' :: (Monad m) => Pattern -> Series m Builder
37−regexSeries' p =
28+regexSeries' pt =
38− case p of
29+ case pt of
39 PEmpty -> pure mempty
30 PEmpty -> pure mempty
40 PChar {..} -> pure $ singleton getPatternChar
31 PChar {..} -> pure $ singleton getPatternChar
41 PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> do
32 PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> do
@@ -82,4 +73,4 @@ regexSeries' p =
82 'D' -> notChars $ ['0' .. '9']
73 'D' -> notChars $ ['0' .. '9']
83 'W' -> notChars $ ['0' .. '9'] ++ '_' : ['a' .. 'z'] ++ ['A' .. 'Z']
74 'W' -> notChars $ ['0' .. '9'] ++ '_' : ['a' .. 'z'] ++ ['A' .. 'Z']
84 'S' -> notChars "\9\32"
75 'S' -> notChars "\9\32"
85− ch -> [ch]
76+ ch' -> [ch']
src/Data/Schematic/Path.hs−1
@@ -1,7 +1,6 @@
1module Data.Schematic.Path where
1module Data.Schematic.Path where
2
2
3import Data.Foldable as F
3import Data.Foldable as F
4−import Data.Monoid
5import Data.Singletons.Prelude
4import Data.Singletons.Prelude
6import Data.Singletons.TypeLits
5import Data.Singletons.TypeLits
7import Data.Text as T
6import Data.Text as T
src/Data/Schematic/Verifier/Array.hs−8
@@ -1,15 +1,7 @@
1module Data.Schematic.Verifier.Array where
1module Data.Schematic.Verifier.Array where
2
2
3−import Data.List
4−import Data.Maybe
5import Data.Schematic
3import Data.Schematic
6import Data.Schematic.Verifier.Common
4import 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
13
5
14data VerifiedArrayConstraint =
6data VerifiedArrayConstraint =
15 VAEq Integer
7 VAEq Integer
src/Data/Schematic/Verifier/Common.hs+2−2
@@ -18,8 +18,8 @@ verifyDNEq :: [Integer] -> Maybe (Maybe Integer)
18verifyDNEq x =
18verifyDNEq x =
19 case nub x of
19 case nub x of
20 [] -> Just Nothing
20 [] -> Just Nothing
21− [x] -> Just $ Just x
21+ [y] -> Just $ Just y
22− (x:y:_) -> Nothing
22+ (_:_:_) -> Nothing
23
23
24verify3 :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe ()
24verify3 :: Maybe Integer -> Maybe Integer -> Maybe Integer -> Maybe ()
25verify3 (Just x) (Just y) (Just z) =
25verify3 (Just x) (Just y) (Just z) =
src/Data/Schematic/Verifier/Number.hs−9
@@ -1,16 +1,7 @@
1module Data.Schematic.Verifier.Number where
1module Data.Schematic.Verifier.Number where
2
2
3−import Data.List
4−import Data.Maybe
5import Data.Schematic
3import Data.Schematic
6−import Data.Schematic.Schema
7import Data.Schematic.Verifier.Common
4import 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
14
5
15toStrictNumber :: [DemotedNumberConstraint] -> [DemotedNumberConstraint]
6toStrictNumber :: [DemotedNumberConstraint] -> [DemotedNumberConstraint]
16toStrictNumber = map f
7toStrictNumber = map f
src/Data/Schematic/Verifier/Text.hs+8−17
@@ -1,19 +1,10 @@
1module Data.Schematic.Verifier.Text where
1module Data.Schematic.Verifier.Text where
2
2
3import Control.Monad
3import Control.Monad
4−import Data.List
5import Data.Maybe
4import Data.Maybe
6import Data.Schematic
5import Data.Schematic
7−import Data.Schematic.Schema
8import Data.Schematic.Verifier.Common
6import Data.Schematic.Verifier.Common
9−import Data.Singletons
7+import Data.Text (Text, unpack)
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
17import Text.Regex.TDFA.Pattern
8import Text.Regex.TDFA.Pattern
18import Text.Regex.TDFA.ReadRegex (parseRegex)
9import Text.Regex.TDFA.ReadRegex (parseRegex)
19
10
@@ -62,12 +53,12 @@ minRegexLength p =
62 case p of
53 case p of
63 PEmpty -> 0
54 PEmpty -> 0
64 PChar {..} -> 1
55 PChar {..} -> 1
65− PAny {getPatternSet = PatternSet (Just cset) _ _ _} -> 1
56+ PAny {..} -> 1
66− PAnyNot {getPatternSet = PatternSet (Just cset) _ _ _} -> 1
57+ PAnyNot {..} -> 1
67− PQuest p -> 0
58+ PQuest _ -> 0
68− PPlus p -> minRegexLength $ PBound 1 Nothing p
59+ PPlus sch -> minRegexLength $ PBound 1 Nothing sch
69− PStar _ p -> minRegexLength $ PBound 0 Nothing p
60+ PStar _ sch -> minRegexLength $ PBound 0 Nothing sch
70− PBound low mhigh p -> low * minRegexLength p
61+ PBound low _ sch -> low * minRegexLength sch
71 PConcat ps -> sum $ fmap minRegexLength ps
62 PConcat ps -> sum $ fmap minRegexLength ps
72 POr xs -> minimum $ fmap minRegexLength xs
63 POr xs -> minimum $ fmap minRegexLength xs
73 PDot _ -> 1
64 PDot _ -> 1
@@ -86,7 +77,7 @@ maxRegexLength p =
86 PQuest _ -> Just 0
77 PQuest _ -> Just 0
87 PPlus _ -> Nothing
78 PPlus _ -> Nothing
88 PStar _ _ -> Nothing
79 PStar _ _ -> Nothing
89− PBound low mhigh p -> (*) <$> mhigh <*> maxRegexLength p
80+ PBound _ mhigh sch -> (*) <$> mhigh <*> maxRegexLength sch
90 PConcat ps -> sum <$> mapM maxRegexLength ps
81 PConcat ps -> sum <$> mapM maxRegexLength ps
91 POr xs -> maximum <$> mapM maxRegexLength xs
82 POr xs -> maximum <$> mapM maxRegexLength xs
92 PDot _ -> Just 1
83 PDot _ -> Just 1