Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- decodeYaml :: FilePath -> IO (Either String ([String], Value))
- class FromValue a where
- data Parser a
- type Result a = Either String (a, [String])
- decodeValue :: FromValue a => Value -> Result a
- class Generic a
- class GenericDecode f
- genericFromValue :: forall a d m. (Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a
- data Options = Options {}
- genericFromValueWith :: (Generic a, GenericDecode (Rep a)) => Options -> Value -> Parser a
- typeMismatch :: String -> Value -> Parser a
- withObject :: (Object -> Parser a) -> Value -> Parser a
- withText :: (Text -> Parser a) -> Value -> Parser a
- withString :: (String -> Parser a) -> Value -> Parser a
- withArray :: (Array -> Parser a) -> Value -> Parser a
- withNumber :: (Scientific -> Parser a) -> Value -> Parser a
- withBool :: (Bool -> Parser a) -> Value -> Parser a
- parseArray :: (Value -> Parser a) -> Array -> Parser [a]
- traverseObject :: (Value -> Parser a) -> Object -> Parser [(Text, a)]
- (.:) :: FromValue a => Object -> Text -> Parser a
- (.:?) :: FromValue a => Object -> Text -> Parser (Maybe a)
- data Value
- type Object = HashMap Text Value
- type Array = Vector Value
Documentation
NOTE: This module is exposed to allow integration of Hpack into other tools. It is not meant for general use by end users. The following caveats apply:
- The API is undocumented, consult the source instead.
- The exposed types and functions primarily serve Hpack's own needs, not that of a public API. Breaking changes can happen as Hpack evolves.
As an Hpack user you either want to use the hpack
executable or a build
tool that supports Hpack (e.g. stack
or cabal2nix
).
class FromValue a where Source #
Nothing
fromValue :: Value -> Parser a Source #
fromValue :: forall d m. (Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a Source #
Instances
FromValue Bool Source # | |
FromValue Int Source # | |
FromValue String Source # | |
FromValue Text Source # | |
FromValue VersionConstraint Source # | |
Defined in Hpack.Syntax.DependencyVersion | |
FromValue Dependencies Source # | |
Defined in Hpack.Syntax.Dependencies | |
FromValue SystemBuildTools Source # | |
Defined in Hpack.Syntax.BuildTools | |
FromValue BuildType Source # | |
FromValue Verbatim Source # | |
FromValue VerbatimValue Source # | |
Defined in Hpack.Config | |
FromValue a => FromValue [a] Source # | |
FromValue a => FromValue (Maybe a) Source # | |
(FromValue a, FromValue b) => FromValue (Either a b) Source # | |
(FromValue a, FromValue b) => FromValue (a, b) Source # | |
FromValue a => FromValue (Map String a) Source # | |
Representable types of kind *
.
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic
instance must satisfy the following laws:
from
.to
≡id
to
.from
≡id
Instances
class GenericDecode f Source #
genericDecode
Instances
(GenericDecode a, GenericDecode b) => GenericDecode (a :*: b) Source # | |
Defined in Data.Aeson.Config.FromValue genericDecode :: Options -> Value -> Parser ((a :*: b) p) | |
GenericDecode a => GenericDecode (D1 d a) Source # | |
Defined in Data.Aeson.Config.FromValue genericDecode :: Options -> Value -> Parser (D1 d a p) | |
GenericDecode a => GenericDecode (C1 c a) Source # | |
Defined in Data.Aeson.Config.FromValue genericDecode :: Options -> Value -> Parser (C1 c a p) | |
(Selector sel, FromValue a) => GenericDecode (S1 sel (Rec0 (Maybe a))) Source # | |
Defined in Data.Aeson.Config.FromValue | |
(Selector sel, FromValue a) => GenericDecode (S1 sel (Rec0 a)) Source # | |
Defined in Data.Aeson.Config.FromValue |
genericFromValue :: forall a d m. (Generic a, Rep a ~ D1 d m, Datatype d, GenericDecode (Rep a)) => Value -> Parser a Source #
genericFromValueWith :: (Generic a, GenericDecode (Rep a)) => Options -> Value -> Parser a Source #
withNumber :: (Scientific -> Parser a) -> Value -> Parser a Source #
A JSON value represented as a Haskell value.
Instances
Eq Value | |
Data Value | |
Defined in Data.Aeson.Types.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Value -> c Value # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Value # dataTypeOf :: Value -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Value) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Value) # gmapT :: (forall b. Data b => b -> b) -> Value -> Value # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Value -> r # gmapQ :: (forall d. Data d => d -> u) -> Value -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Value -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Value -> m Value # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Value -> m Value # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Value -> m Value # | |
Read Value | |
Show Value | |
IsString Value | |
Defined in Data.Aeson.Types.Internal fromString :: String -> Value # | |
Generic Value | |
Lift Value | |
NFData Value | |
Defined in Data.Aeson.Types.Internal | |
Hashable Value | |
Defined in Data.Aeson.Types.Internal | |
ToJSON Value | |
Defined in Data.Aeson.Types.ToJSON | |
KeyValue Object | Constructs a singleton |
KeyValue Pair | |
FromJSON Value | |
FromString Encoding | |
Defined in Data.Aeson.Types.ToJSON fromString :: String -> Encoding | |
FromString Value | |
Defined in Data.Aeson.Types.ToJSON fromString :: String -> Value | |
GToJSON Encoding arity (U1 :: Type -> Type) | |
GToJSON Value arity (V1 :: Type -> Type) | |
GToJSON Value arity (U1 :: Type -> Type) | |
ToJSON1 f => GToJSON Encoding One (Rec1 f) | |
ToJSON1 f => GToJSON Value One (Rec1 f) | |
ToJSON a => GToJSON Encoding arity (K1 i a :: Type -> Type) | |
(EncodeProduct arity a, EncodeProduct arity b) => GToJSON Encoding arity (a :*: b) | |
ToJSON a => GToJSON Value arity (K1 i a :: Type -> Type) | |
(WriteProduct arity a, WriteProduct arity b, ProductSize a, ProductSize b) => GToJSON Value arity (a :*: b) | |
(ToJSON1 f, GToJSON Encoding One g) => GToJSON Encoding One (f :.: g) | |
(ToJSON1 f, GToJSON Value One g) => GToJSON Value One (f :.: g) | |
FromPairs Value (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON | |
v ~ Value => KeyValuePair v (DList Pair) | |
Defined in Data.Aeson.Types.ToJSON | |
(GToJSON Encoding arity a, ConsToJSON Encoding arity a, Constructor c) => SumToJSON' TwoElemArray Encoding arity (C1 c a) | |
Defined in Data.Aeson.Types.ToJSON | |
(GToJSON Value arity a, ConsToJSON Value arity a, Constructor c) => SumToJSON' TwoElemArray Value arity (C1 c a) | |
Defined in Data.Aeson.Types.ToJSON | |
type Rep Value | |
Defined in Data.Aeson.Types.Internal type Rep Value = D1 (MetaData "Value" "Data.Aeson.Types.Internal" "aeson-1.4.4.0-4KBHtuUHf3rGRTxXrPSW9L" False) ((C1 (MetaCons "Object" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Object)) :+: (C1 (MetaCons "Array" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Array)) :+: C1 (MetaCons "String" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))) :+: (C1 (MetaCons "Number" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Scientific)) :+: (C1 (MetaCons "Bool" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Bool)) :+: C1 (MetaCons "Null" PrefixI False) (U1 :: Type -> Type)))) |