Safe Haskell | None |
---|---|
Language | Haskell2010 |
Representation of GraphQL names.
- data Name
- newtype NameError = NameError Text
- makeName :: Text -> Either NameError Name
- nameFromSymbol :: forall n. KnownSymbol n => Either NameError Name
- class HasName a where
- unsafeMakeName :: HasCallStack => Text -> Name
Documentation
A name in GraphQL.
An invalid name.
makeName :: Text -> Either NameError Name Source #
Create a Name
.
Names must match the regex [_A-Za-z][_0-9A-Za-z]*
. If the given text does
not match, return Nothing.
>>>
makeName "foo"
Right (Name {unName = "foo"})>>>
makeName "9-bar"
Left (NameError "9-bar")
nameFromSymbol :: forall n. KnownSymbol n => Either NameError Name Source #
Named things
class HasName a where Source #
Types that implement this have values with a single canonical name in a GraphQL schema.
e.g. a field foo(bar: Int32)
would have the name "foo"
.
If a thing *might* have a name, or has a name that might not be valid, don't use this.
If a thing is aliased, then return the *original* name.
Unsafe functions
unsafeMakeName :: HasCallStack => Text -> Name Source #