Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data SumType (lang :: Language) = SumType (TypeInfo lang) [DataConstructor lang] [Instance]
- mkSumType :: forall t. (Generic t, Typeable t, GDataConstructor (Rep t)) => Proxy t -> SumType 'Haskell
- equal :: Eq a => Proxy a -> SumType t -> SumType t
- order :: Ord a => Proxy a -> SumType t -> SumType t
- data DataConstructor (lang :: Language) = DataConstructor {
- _sigConstructor :: !Text
- _sigValues :: !(Either [TypeInfo lang] [RecordEntry lang])
- data RecordEntry (lang :: Language) = RecordEntry {}
- data Instance
- = Encode
- | EncodeJson
- | Decode
- | DecodeJson
- | Generic
- | Newtype
- | Eq
- | Ord
- nootype :: [DataConstructor lang] -> Maybe Instance
- getUsedTypes :: SumType lang -> Set (TypeInfo lang)
- constructorToTypes :: DataConstructor lang -> Set (TypeInfo lang) -> Set (TypeInfo lang)
- sigConstructor :: forall lang. Lens' (DataConstructor lang) Text
- sigValues :: forall lang lang. Lens (DataConstructor lang) (DataConstructor lang) (Either [TypeInfo lang] [RecordEntry lang]) (Either [TypeInfo lang] [RecordEntry lang])
- sumTypeInfo :: Functor f => (TypeInfo lang -> f (TypeInfo lang)) -> SumType lang -> f (SumType lang)
- sumTypeConstructors :: Functor f => ([DataConstructor lang] -> f [DataConstructor lang]) -> SumType lang -> f (SumType lang)
- recLabel :: forall lang. Lens' (RecordEntry lang) Text
- recValue :: forall lang lang. Lens (RecordEntry lang) (RecordEntry lang) (TypeInfo lang) (TypeInfo lang)
Documentation
data SumType (lang :: Language) Source #
Generic representation of your Haskell types.
SumType (TypeInfo lang) [DataConstructor lang] [Instance] |
mkSumType :: forall t. (Generic t, Typeable t, GDataConstructor (Rep t)) => Proxy t -> SumType 'Haskell Source #
Create a representation of your sum (and product) types,
for doing type translations and writing it out to your PureScript modules.
In order to get the type information we use a dummy variable of type Proxy
(YourType).
equal :: Eq a => Proxy a -> SumType t -> SumType t Source #
Ensure that an Instance
instance is generated for your type.
data DataConstructor (lang :: Language) Source #
DataConstructor | |
|
Instances
Show (DataConstructor lang) Source # | |
Defined in Language.PureScript.Bridge.SumType showsPrec :: Int -> DataConstructor lang -> ShowS # show :: DataConstructor lang -> String # showList :: [DataConstructor lang] -> ShowS # | |
Eq (DataConstructor lang) Source # | |
Defined in Language.PureScript.Bridge.SumType (==) :: DataConstructor lang -> DataConstructor lang -> Bool # (/=) :: DataConstructor lang -> DataConstructor lang -> Bool # |
data RecordEntry (lang :: Language) Source #
Instances
Show (RecordEntry lang) Source # | |
Defined in Language.PureScript.Bridge.SumType showsPrec :: Int -> RecordEntry lang -> ShowS # show :: RecordEntry lang -> String # showList :: [RecordEntry lang] -> ShowS # | |
Eq (RecordEntry lang) Source # | |
Defined in Language.PureScript.Bridge.SumType (==) :: RecordEntry lang -> RecordEntry lang -> Bool # (/=) :: RecordEntry lang -> RecordEntry lang -> Bool # |
Purescript typeclass instances that can be generated for your Haskell types.
nootype :: [DataConstructor lang] -> Maybe Instance Source #
The Purescript typeclass Newtype
might be derivable if the original
Haskell type was a simple type wrapper.
getUsedTypes :: SumType lang -> Set (TypeInfo lang) Source #
Get all used types in a sum type.
This includes all types found at the right hand side of a sum type definition, not the type parameters of the sum type itself
constructorToTypes :: DataConstructor lang -> Set (TypeInfo lang) -> Set (TypeInfo lang) Source #
sigConstructor :: forall lang. Lens' (DataConstructor lang) Text Source #
sigValues :: forall lang lang. Lens (DataConstructor lang) (DataConstructor lang) (Either [TypeInfo lang] [RecordEntry lang]) (Either [TypeInfo lang] [RecordEntry lang]) Source #
sumTypeInfo :: Functor f => (TypeInfo lang -> f (TypeInfo lang)) -> SumType lang -> f (SumType lang) Source #
TypInfo lens for SumType
.
sumTypeConstructors :: Functor f => ([DataConstructor lang] -> f [DataConstructor lang]) -> SumType lang -> f (SumType lang) Source #
DataConstructor lens for SumType
.
recValue :: forall lang lang. Lens (RecordEntry lang) (RecordEntry lang) (TypeInfo lang) (TypeInfo lang) Source #