winery-1.0.1: Sustainable serialisation library

Copyright(c) Fumiaki Kinoshita 2019
LicenseBSD3
StabilityExperimental
Safe HaskellNone
LanguageHaskell2010

Data.Winery.Query

Description

Maintainer : Fumiaki Kinoshita fumiexcel@gmail.com

Building blocks for winery queries.

Synopsis

Documentation

newtype Query a b Source #

Query is a transformation between Extractors. Like jq, this returns a list of values.

Constructors

Query 

Fields

Instances
Functor (Query a) Source # 
Instance details

Defined in Data.Winery.Query

Methods

fmap :: (a0 -> b) -> Query a a0 -> Query a b #

(<$) :: a0 -> Query a b -> Query a a0 #

Applicative (Query a) Source # 
Instance details

Defined in Data.Winery.Query

Methods

pure :: a0 -> Query a a0 #

(<*>) :: Query a (a0 -> b) -> Query a a0 -> Query a b #

liftA2 :: (a0 -> b -> c) -> Query a a0 -> Query a b -> Query a c #

(*>) :: Query a a0 -> Query a b -> Query a b #

(<*) :: Query a a0 -> Query a b -> Query a a0 #

Alternative (Query a) Source # 
Instance details

Defined in Data.Winery.Query

Methods

empty :: Query a a0 #

(<|>) :: Query a a0 -> Query a a0 -> Query a a0 #

some :: Query a a0 -> Query a [a0] #

many :: Query a a0 -> Query a [a0] #

Category Query Source # 
Instance details

Defined in Data.Winery.Query

Methods

id :: Query a a #

(.) :: Query b c -> Query a b -> Query a c #

invalid :: WineryException -> Query a b Source #

Throw an error.

list :: Typeable a => Query a a Source #

Takes a list and traverses on it.

range :: Typeable a => Int -> Int -> Query a a Source #

Takes a list and enumerates elements in the specified range. Like Python's array slicing, negative numbers counts from the last element.

field :: Typeable a => Text -> Query a a Source #

Takes a record and extracts the specified field.

con :: Typeable a => Text -> Query a a Source #

Takes a variant and returns a value when the constructor matches.

select :: Query a Bool -> Query a a Source #

Propagate values if the supplied Query doesn't return False.