Module
Routing.Duplex.Generic
- Package
- purescript-routing-duplex
- Repository
- natefaubion/purescript-routing-duplex
#sum Source
sum :: forall a rep r. Generic a rep => GRouteDuplex rep r => Record r -> RouteDuplex' a
Builds a parser/printer from a record, where each record field corresponds to a constructor name for your data type.
Note: this implicitly inserts calls to end
for each constructor, making
the parser only valid for parsing URI suffixes. To parse URI prefixes, or
to just have more explicit control, use sumPrefix
.
#sumPrefix Source
sumPrefix :: forall a rep r. Generic a rep => GRouteDuplex rep r => Record r -> RouteDuplex' a
A variation of sum
that does not implicitly add an end
to each branch.
This is useful for defining sub-parsers that may consume only some of the
URI segments, leaving the rest for subsequent parsers.
#GRouteDuplex Source
class GRouteDuplex :: Type -> Row Type -> Constraint
class GRouteDuplex rep (r :: Row Type) | rep -> r where
Members
gRouteDuplex :: (forall x y. RouteDuplex x y -> RouteDuplex x y) -> Record r -> RouteDuplex' rep
Instances
(GRouteDuplex a r, GRouteDuplex b r) => GRouteDuplex (Sum a b) r
(IsSymbol sym, Cons sym (RouteDuplex a a) rx r, GRouteDuplexCtr a b) => GRouteDuplex (Constructor sym b) r
#GRouteDuplexCtr Source
class GRouteDuplexCtr a b | a -> b where
Members
gRouteDuplexCtr :: RouteDuplex' a -> RouteDuplex' b
Instances
GRouteDuplexCtr (Product a b) (Product a b)
GRouteDuplexCtr NoArguments NoArguments
GRouteDuplexCtr (Argument a) (Argument a)
GRouteDuplexCtr a (Argument a)
#product Source
product :: forall a b c. GRouteDuplexCtr b c => RouteDuplex' a -> RouteDuplex' b -> RouteDuplex' (Product (Argument a) c)