graphql-api-0.4.0: GraphQL API

Safe HaskellNone
LanguageHaskell2010

GraphQL.Internal.Name

Contents

Description

 
Synopsis

Documentation

newtype Name Source #

Constructors

Name 

Fields

Instances
Eq Name Source # 
Instance details

Defined in GraphQL.Internal.Name

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Ord Name Source # 
Instance details

Defined in GraphQL.Internal.Name

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Show Name Source # 
Instance details

Defined in GraphQL.Internal.Name

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

IsString Name Source # 
Instance details

Defined in GraphQL.Internal.Name

Methods

fromString :: String -> Name #

Arbitrary Name Source # 
Instance details

Defined in GraphQL.Internal.Name

Methods

arbitrary :: Gen Name #

shrink :: Name -> [Name] #

ToJSON Name Source # 
Instance details

Defined in GraphQL.Internal.Name

newtype NameError Source #

An invalid name.

Constructors

NameError Text 
Instances
Eq NameError Source # 
Instance details

Defined in GraphQL.Internal.Name

Show NameError Source # 
Instance details

Defined in GraphQL.Internal.Name

GraphQLError NameError Source # 
Instance details

Defined in GraphQL.Internal.Output

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 NameError.

>>> makeName "foo"
Right (Name {unName = "foo"})
>>> makeName "9-bar"
Left (NameError "9-bar")

nameFromSymbol :: forall (n :: Symbol). KnownSymbol n => Either NameError Name Source #

Convert a type-level Symbol into a GraphQL Name.

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.

Methods

getName :: a -> Name Source #

Get the name of the object.

Instances
HasName GType Source #

Get the name of the given GType.

Instance details

Defined in GraphQL.Internal.Syntax.AST

Methods

getName :: GType -> Name Source #

HasName InputTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName InputType Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName InputObjectFieldDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName InputObjectTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName EnumValueDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName EnumTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName Builtin Source # 
Instance details

Defined in GraphQL.Internal.Schema

Methods

getName :: Builtin -> Name Source #

HasName ScalarTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName UnionTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName InterfaceTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName ArgumentDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName FieldDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName ObjectTypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName TypeDefinition Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName GType Source # 
Instance details

Defined in GraphQL.Internal.Schema

Methods

getName :: GType -> Name Source #

HasName t => HasName (AnnotatedType t) Source # 
Instance details

Defined in GraphQL.Internal.Schema

HasName (Field value) Source # 
Instance details

Defined in GraphQL.Internal.Validation

Methods

getName :: Field value -> Name Source #

Unsafe functions

unsafeMakeName :: HasCallStack => Text -> Name Source #

Create a Name, panicking if the given text is invalid.

Prefer makeName to this in all cases.

>>> unsafeMakeName "foo"
Name {unName = "foo"}