-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | JSON-biased spec and validation tool -- -- JSON-biased spec and validation tool @package schematic @version 0.1.0.0 module Data.Schematic.Utils class Known a known :: Known a => a instance forall k (a :: k). Data.Schematic.Utils.Known (Data.Proxy.Proxy a) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing n) instance GHC.TypeLits.KnownSymbol s => Data.Schematic.Utils.Known (Data.Singletons.Sing s) instance forall k k1 (a :: k1) (b :: k). (Data.Schematic.Utils.Known (Data.Singletons.Sing a), Data.Schematic.Utils.Known (Data.Singletons.Sing b)) => Data.Schematic.Utils.Known (Data.Singletons.Sing '(a, b)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing '[]) instance forall a (a1 :: a) (as :: [a]). (Data.Schematic.Utils.Known (Data.Singletons.Sing a1), Data.Schematic.Utils.Known (Data.Singletons.Sing as)) => Data.Schematic.Utils.Known (Data.Singletons.Sing (a1 : as)) instance Data.Schematic.Utils.Known (Data.Vinyl.Core.Rec Data.Singletons.Sing '[]) instance forall u (a :: u) (tl :: [u]). (Data.Schematic.Utils.Known (Data.Singletons.Sing a), Data.Schematic.Utils.Known (Data.Vinyl.Core.Rec Data.Singletons.Sing tl)) => Data.Schematic.Utils.Known (Data.Vinyl.Core.Rec Data.Singletons.Sing (a : tl)) module Data.Schematic.Path data PathSegment Key :: Symbol -> PathSegment Ix :: Nat -> PathSegment data DemotedPathSegment DKey :: Text -> DemotedPathSegment DIx :: Integer -> DemotedPathSegment -- | Textual representation of json path. newtype JSONPath JSONPath :: Text -> JSONPath demotePath :: Sing (ps :: [PathSegment]) -> [DemotedPathSegment] demotedPathToText :: [DemotedPathSegment] -> JSONPath pathToText :: Sing (ps :: [PathSegment]) -> JSONPath instance GHC.Show.Show Data.Schematic.Path.JSONPath instance GHC.Show.Show Data.Schematic.Path.DemotedPathSegment instance (GHC.TypeLits.KnownSymbol k, Data.Schematic.Utils.Known (Data.Singletons.Sing k)) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Path.Key k)) instance (GHC.TypeLits.KnownNat n, Data.Schematic.Utils.Known (Data.Singletons.Sing n)) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Path.Ix n)) module Data.Schematic.Instances instance forall u (m :: * -> *) (f :: u -> GHC.Types.*). GHC.Base.Monad m => Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec f '[]) instance forall a (m :: * -> *) (f :: a -> *) (a1 :: a) (as :: [a]). (Test.SmallCheck.Series.Serial m (f a1), Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec f as), GHC.Base.Monad m) => Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec f (a1 : as)) instance Test.SmallCheck.Series.Serial m a => Test.SmallCheck.Series.Serial m (Data.Vector.Vector a) instance GHC.Base.Monad m => Test.SmallCheck.Series.Serial m Data.Scientific.Scientific module Data.Schematic.Schema data TextConstraint TEq :: Nat -> TextConstraint TLe :: Nat -> TextConstraint TGt :: Nat -> TextConstraint TRegex :: Symbol -> TextConstraint TEnum :: [Symbol] -> TextConstraint data NumberConstraint NLe :: Nat -> NumberConstraint NGt :: Nat -> NumberConstraint NEq :: Nat -> NumberConstraint data ArrayConstraint AEq :: Nat -> ArrayConstraint data Schema SchemaText :: [TextConstraint] -> Schema SchemaNumber :: [NumberConstraint] -> Schema SchemaObject :: [(Symbol, Schema)] -> Schema SchemaArray :: [ArrayConstraint] -> Schema -> Schema SchemaNull :: Schema SchemaOptional :: Schema -> Schema data FieldRepr :: (Symbol, Schema) -> Type [FieldRepr] :: (Known (Sing schema), KnownSymbol name) => JsonRepr schema -> FieldRepr '(name, schema) knownFieldName :: forall proxy (fieldName :: Symbol) schema. KnownSymbol fieldName => proxy '(fieldName, schema) -> Text knownFieldSchema :: forall proxy fieldName schema. Known (Sing schema) => proxy '(fieldName, schema) -> Sing schema data JsonRepr :: Schema -> Type [ReprText] :: Text -> JsonRepr (SchemaText cs) [ReprNumber] :: Scientific -> JsonRepr (SchemaNumber cs) [ReprNull] :: JsonRepr SchemaNull [ReprArray] :: Vector (JsonRepr s) -> JsonRepr (SchemaArray cs s) [ReprObject] :: Rec FieldRepr fs -> JsonRepr (SchemaObject fs) [ReprOptional] :: Maybe (JsonRepr s) -> JsonRepr (SchemaOptional s) fromOptional :: (Known (Sing s)) => Sing (SchemaOptional s) -> Value -> Parser (Maybe (JsonRepr s)) class FalseConstraint a instance GHC.Generics.Generic Data.Schematic.Schema.Schema instance GHC.Generics.Generic Data.Schematic.Schema.ArrayConstraint instance GHC.Generics.Generic Data.Schematic.Schema.NumberConstraint instance GHC.Generics.Generic Data.Schematic.Schema.TextConstraint instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr schema) => GHC.Show.Show (Data.Schematic.Schema.FieldRepr '(name, schema)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.TEq n)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.TGt n)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.TLe n)) instance (GHC.TypeLits.KnownSymbol s, Data.Schematic.Utils.Known (Data.Singletons.Sing s)) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.TRegex s)) instance (Data.Schematic.Schema.All GHC.TypeLits.KnownSymbol ss, Data.Schematic.Utils.Known (Data.Singletons.Sing ss)) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.TEnum ss)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TEq n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TLe n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TGt n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TRegex t)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.TEnum ss)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.NEq n)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.NGt n)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.NLe n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NEq n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NLe n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.NGt n)) instance GHC.TypeLits.KnownNat n => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.AEq n)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.AEq n)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing sl) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaText sl)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing sl) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaNumber sl)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing 'Data.Schematic.Schema.SchemaNull) instance (Data.Schematic.Utils.Known (Data.Singletons.Sing ac), Data.Schematic.Utils.Known (Data.Singletons.Sing s)) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaArray ac s)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing stl) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaObject stl)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing s) => Data.Schematic.Utils.Known (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaOptional s)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaText cs)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Classes.Eq (Data.Singletons.Sing 'Data.Schematic.Schema.SchemaNull) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaArray as s)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaObject cs)) instance GHC.Classes.Eq (Data.Singletons.Sing ('Data.Schematic.Schema.SchemaOptional s)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr schema) => GHC.Classes.Eq (Data.Schematic.Schema.FieldRepr '(name, schema)) instance (GHC.TypeLits.KnownSymbol name, Data.Schematic.Utils.Known (Data.Singletons.Sing schema), Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr schema)) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.FieldRepr '(name, schema)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr 'Data.Schematic.Schema.SchemaNull) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr s) => GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray acs s)) instance Data.Vinyl.TypeLevel.RecAll Data.Schematic.Schema.FieldRepr fs GHC.Show.Show => GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaObject fs)) instance GHC.Show.Show (Data.Schematic.Schema.JsonRepr s) => GHC.Show.Show (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaOptional s)) instance (GHC.Base.Monad m, Test.SmallCheck.Series.Serial m Data.Text.Internal.Text) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance (GHC.Base.Monad m, Test.SmallCheck.Series.Serial m Data.Scientific.Scientific) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Base.Monad m => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr 'Data.Schematic.Schema.SchemaNull) instance Test.SmallCheck.Series.Serial m (Data.Vector.Vector (Data.Schematic.Schema.JsonRepr s)) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray cs s)) instance Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr s) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaOptional s)) instance (GHC.Base.Monad m, Test.SmallCheck.Series.Serial m (Data.Vinyl.Core.Rec Data.Schematic.Schema.FieldRepr fs)) => Test.SmallCheck.Series.Serial m (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaObject fs)) instance GHC.Classes.Eq (Data.Vinyl.Core.Rec Data.Schematic.Schema.FieldRepr fs) => GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaObject fs)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaText cs)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaNumber cs)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr 'Data.Schematic.Schema.SchemaNull) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr s) => GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaArray as s)) instance GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr s) => GHC.Classes.Eq (Data.Schematic.Schema.JsonRepr ('Data.Schematic.Schema.SchemaOptional s)) instance Data.Schematic.Utils.Known (Data.Singletons.Sing schema) => Data.Aeson.Types.FromJSON.FromJSON (Data.Schematic.Schema.JsonRepr schema) instance Data.Aeson.Types.ToJSON.ToJSON (Data.Schematic.Schema.JsonRepr a) module Data.Schematic.Validation type Validation a = ValidationT ErrorMap Identity a type ErrorMap = MonoidMap Text [Text] data ParseResult a Valid :: a -> ParseResult a DecodingError :: Text -> ParseResult a ValidationError :: ErrorMap -> ParseResult a validateTextConstraint :: JSONPath -> Text -> Sing (tcs :: TextConstraint) -> Validation () validateNumberConstraint :: JSONPath -> Scientific -> Sing (tcs :: NumberConstraint) -> Validation () validateArrayConstraint :: JSONPath -> Vector a -> Sing (tcs :: ArrayConstraint) -> Validation () validateJsonRepr :: Sing schema -> [DemotedPathSegment] -> JsonRepr schema -> Validation () instance GHC.Base.Functor Data.Schematic.Validation.ParseResult instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Schematic.Validation.ParseResult a) instance GHC.Show.Show a => GHC.Show.Show (Data.Schematic.Validation.ParseResult a) module Data.Schematic parseAndValidateJson :: forall schema. (FromJSON (JsonRepr schema), TopLevel schema, Known (Sing schema)) => Value -> ParseResult (JsonRepr schema)