Module
Data.Generic
- Package
- purescript-genericsDEPRECATED
- Repository
- purescript/purescript-generics
#Generic Source
class Generic a whereThe Generic typeclass provides methods for sending data to/from spine representations, as well as querying about the signatures of spine representations.
For standard data structures, you can simply write
derive instance genericFoo :: Generic Foo in the module they are
declared, and the instance methods will be filled in for you.
Members
toSpine :: a -> GenericSpinetoSignature :: Proxy a -> GenericSignaturefromSpine :: GenericSpine -> Maybe a
Instances
Generic NumberGeneric IntGeneric StringGeneric CharGeneric Boolean(Generic a) => Generic (Array a)Generic UnitGeneric Void(Generic a, Generic b) => Generic (Tuple a b)(Generic a) => Generic (List a)(Generic a) => Generic (NonEmptyList a)(Generic a) => Generic (Maybe a)(Generic a, Generic b) => Generic (Either a b)(Generic a) => Generic (Identity a)Generic Ordering(Generic (f a), Generic a) => Generic (NonEmpty f a)
#GenericSpine Source
data GenericSpineA GenericSpine is a universal representation of an arbitrary data structure (that does not contain function arrows).
Constructors
SProd String (Array (Unit -> GenericSpine))SRecord (Array { recLabel :: String, recValue :: Unit -> GenericSpine })SNumber NumberSBoolean BooleanSInt IntSString StringSChar CharSArray (Array (Unit -> GenericSpine))SUnit
Instances
#GenericSignature Source
data GenericSignatureA GenericSignature is a universal representation of the structure of an arbitrary data structure (that does not contain function arrows).
Constructors
SigProd String (Array DataConstructor)SigRecord (Array { recLabel :: String, recValue :: Unit -> GenericSignature })SigNumberSigBooleanSigIntSigStringSigCharSigArray (Unit -> GenericSignature)SigUnit
Instances
#DataConstructor Source
type DataConstructor = { sigConstructor :: String, sigValues :: Array (Unit -> GenericSignature) }Identifies a data constructor.
#isValidSpine Source
isValidSpine :: GenericSignature -> GenericSpine -> BooleanChecks that the spine follows the structure defined by the signature
- Modules
- Data.
Generic