Safe Haskell | None |
---|---|
Language | Haskell2010 |
- 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
- 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 Eq
instance is generated for your type.
data DataConstructor (lang :: Language) Source #
DataConstructor | |
|
Eq (DataConstructor lang) Source # | |
Show (DataConstructor lang) Source # | |
data RecordEntry (lang :: Language) Source #
Eq (RecordEntry lang) Source # | |
Show (RecordEntry lang) Source # | |
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 #