| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Okapi.HTTP.Request.Path
Synopsis
- data Path a where
- data ParseError = ParseError
- parser :: Tree Path i o -> Parser Path o
- printer :: Tree Path i o -> Printer Path i
- parseExact :: Tree Path i o -> [Text] -> Either (Either ParseError [Text]) o
- segment_ :: Leaf Path a -> a -> Tree Path () ()
- segment :: Text -> Leaf Path a -> Tree Path a a
- segments :: Leaf Path a -> Tree Path (NonEmpty a) (NonEmpty a)
- raw :: Tree Path [Text] [Text]
- data LitF (sym :: Symbol) = LitF
- class GPath (f :: Type -> Type) where
- gPathCodec :: Tree Path (f ()) (f ())
- pathCodec :: (Generic a, GPath (Rep a)) => Tree Path a a
Documentation
Constructors
| Seg_ :: forall a1. Leaf Path a1 -> a1 -> Path () | |
| Seg :: forall a. Text -> Leaf Path a -> Path a | |
| Segs :: forall a1. Leaf Path a1 -> Path (NonEmpty a1) | |
| Raw :: Path [Text] |
Instances
| HasLeaf Path Int16 Source # | |
| HasLeaf Path Int32 Source # | |
| HasLeaf Path Int64 Source # | |
| HasLeaf Path Text Source # | |
| HasLeaf Path UUID Source # | |
| HasLeaf Path Integer Source # | |
| HasLeaf Path Int Source # | |
| type Context Path Source # | |
Defined in Okapi.HTTP.Request.Path | |
| type Failure Path Source # | |
Defined in Okapi.HTTP.Request.Path | |
| type Piece Path Source # | |
Defined in Okapi.HTTP.Request.Path | |
data ParseError Source #
Constructors
| ParseError |
Instances
| Show ParseError Source # | |
Defined in Okapi.HTTP.Request.Path Methods showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS # | |
| Eq ParseError Source # | |
Defined in Okapi.HTTP.Request.Path | |
parseExact :: Tree Path i o -> [Text] -> Either (Either ParseError [Text]) o Source #
segment_ :: Leaf Path a -> a -> Tree Path () () Source #
Match a fixed literal segment.
>>>printer (segment_ int 42) ()["42"]>>>parser (segment_ int 42) ["42"](Right (),[])>>>parser (segment_ int 42) ["99"](Left ParseError,["99"])
segment :: Text -> Leaf Path a -> Tree Path a a Source #
Parse and print a single typed path segment.
>>>printer (segment "id" int) (42 :: Int)["42"]>>>parser (segment "id" int) ["42"](Right 42,[])>>>parser (segment "id" int) ["hello"](Left ParseError,["hello"])>>>parser (segment "id" int) [](Left ParseError,[])
printParse parser printer (segment "n" int) (x :: Int)
printParse parser printer (segment "n" integer) x
printStable parser printer (segment "n" int) (x :: Int)
segments :: Leaf Path a -> Tree Path (NonEmpty a) (NonEmpty a) Source #
Parse and print all remaining path segments as a non-empty list.
printParse parser printer (segments int) (x :| xs)
printStable parser printer (segments int) (x :| xs)
data LitF (sym :: Symbol) Source #
Constructors
| LitF |
class GPath (f :: Type -> Type) where Source #
Methods
gPathCodec :: Tree Path (f ()) (f ()) Source #
Instances
| (GPath f, GPath g) => GPath (f :*: g) Source # | |
Defined in Okapi.HTTP.Request.Path | |
| GPath f => GPath (C1 meta f) Source # | |
Defined in Okapi.HTTP.Request.Path | |
| GPath f => GPath (D1 meta f) Source # | |
Defined in Okapi.HTTP.Request.Path | |
| KnownSymbol sym => GPath (S1 meta (Rec0 (LitF sym))) Source # | |
| (Selector meta, HasLeaf Path a) => GPath (S1 meta (Rec0 a)) Source # | |
Defined in Okapi.HTTP.Request.Path | |