Safe Haskell | None |
---|---|
Language | Haskell2010 |
Generate Reason types, JSON decoders & JSON encoders from Haskell datatypes.
Synopsis
- data Options = Options {
- fieldLabelModifier :: Text -> Text
- defaultOptions :: Options
- require :: Text -> RenderM ()
- data Spec = Spec {
- namespace :: [Text]
- declarations :: [Text]
- specsToDir :: [Spec] -> FilePath -> IO ()
- moduleSpecWith :: Options -> [Text] -> RenderM () -> Spec
- moduleSpec :: [Text] -> RenderM () -> Spec
- class HasReasonComparable a where
- toReasonComparable :: a -> ReasonPrimitive
- class GenericReasonValue f where
- genericToReasonValue :: f a -> ReasonValue
- class GenericReasonConstructor f where
- genericToReasonConstructor :: f a -> ReasonConstructor
- class GenericReasonDatatype f where
- genericToReasonDatatype :: f a -> ReasonDatatype
- class ReasonType a where
- toReasonType :: a -> ReasonDatatype
- data ReasonValue
- data ReasonConstructor
- data ReasonPrimitive
- data ReasonDatatype
- isEnumeration :: ReasonConstructor -> Bool
- primitiveName :: ReasonPrimitive -> Text
- toReasonTypeRefWith :: ReasonType a => Options -> a -> Text
- toReasonTypeRef :: ReasonType a => a -> Text
- toReasonTypeSourceWith :: ReasonType a => Options -> a -> Text
- toReasonTypeSource :: ReasonType a => a -> Text
- renderType :: ReasonType a => a -> RenderM ()
- toReasonEncoderRefWith :: ReasonType a => Options -> a -> Text
- toReasonEncoderRef :: ReasonType a => a -> Text
- toReasonEncoderSourceWith :: ReasonType a => Options -> a -> Text
- toReasonEncoderSource :: ReasonType a => a -> Text
- renderEncoder :: ReasonType a => a -> RenderM ()
- toReasonDecoderRefWith :: ReasonType a => Options -> a -> Text
- toReasonDecoderRef :: ReasonType a => a -> Text
- toReasonDecoderSourceWith :: ReasonType a => Options -> a -> Text
- toReasonDecoderSource :: ReasonType a => a -> Text
- renderDecoder :: ReasonType a => a -> RenderM ()
Documentation
Spec | |
|
moduleSpec :: [Text] -> RenderM () -> Spec Source #
class HasReasonComparable a where Source #
toReasonComparable :: a -> ReasonPrimitive Source #
Instances
HasReasonComparable String Source # | |
Defined in Reason.Type | |
HasReasonComparable Text Source # | |
Defined in Reason.Type |
class GenericReasonValue f where Source #
genericToReasonValue :: f a -> ReasonValue Source #
Instances
GenericReasonValue (U1 :: Type -> Type) Source # | |
Defined in Reason.Type genericToReasonValue :: U1 a -> ReasonValue Source # | |
ReasonType a => GenericReasonValue (Rec0 a) Source # | |
Defined in Reason.Type genericToReasonValue :: Rec0 a a0 -> ReasonValue Source # | |
(GenericReasonValue f, GenericReasonValue g) => GenericReasonValue (f :*: g) Source # | |
Defined in Reason.Type genericToReasonValue :: (f :*: g) a -> ReasonValue Source # | |
(Selector s, GenericReasonValue a) => GenericReasonValue (S1 s a) Source # | |
Defined in Reason.Type genericToReasonValue :: S1 s a a0 -> ReasonValue Source # |
class GenericReasonConstructor f where Source #
genericToReasonConstructor :: f a -> ReasonConstructor Source #
Instances
(GenericReasonConstructor f, GenericReasonConstructor g) => GenericReasonConstructor (f :+: g) Source # | |
Defined in Reason.Type genericToReasonConstructor :: (f :+: g) a -> ReasonConstructor Source # | |
(Constructor c, GenericReasonValue f) => GenericReasonConstructor (C1 c f) Source # | |
Defined in Reason.Type genericToReasonConstructor :: C1 c f a -> ReasonConstructor Source # |
class GenericReasonDatatype f where Source #
genericToReasonDatatype :: f a -> ReasonDatatype Source #
Instances
(Datatype d, GenericReasonConstructor f) => GenericReasonDatatype (D1 d f) Source # | |
Defined in Reason.Type genericToReasonDatatype :: D1 d f a -> ReasonDatatype Source # |
class ReasonType a where Source #
Nothing
toReasonType :: a -> ReasonDatatype Source #
toReasonType :: (Generic a, GenericReasonDatatype (Rep a)) => a -> ReasonDatatype Source #
Instances
data ReasonValue Source #
ReasonRef Text | |
ReasonEmpty | |
ReasonPrimitiveRef ReasonPrimitive | |
Values ReasonValue ReasonValue | |
ReasonField Text ReasonValue |
Instances
Eq ReasonValue Source # | |
Defined in Reason.Type (==) :: ReasonValue -> ReasonValue -> Bool # (/=) :: ReasonValue -> ReasonValue -> Bool # | |
Show ReasonValue Source # | |
Defined in Reason.Type showsPrec :: Int -> ReasonValue -> ShowS # show :: ReasonValue -> String # showList :: [ReasonValue] -> ShowS # |
data ReasonConstructor Source #
NamedConstructor Text ReasonValue | |
RecordConstructor Text ReasonValue | |
MultipleConstructors [ReasonConstructor] |
Instances
Eq ReasonConstructor Source # | |
Defined in Reason.Type (==) :: ReasonConstructor -> ReasonConstructor -> Bool # (/=) :: ReasonConstructor -> ReasonConstructor -> Bool # | |
Show ReasonConstructor Source # | |
Defined in Reason.Type showsPrec :: Int -> ReasonConstructor -> ShowS # show :: ReasonConstructor -> String # showList :: [ReasonConstructor] -> ShowS # |
data ReasonPrimitive Source #
Instances
Eq ReasonPrimitive Source # | |
Defined in Reason.Type (==) :: ReasonPrimitive -> ReasonPrimitive -> Bool # (/=) :: ReasonPrimitive -> ReasonPrimitive -> Bool # | |
Show ReasonPrimitive Source # | |
Defined in Reason.Type showsPrec :: Int -> ReasonPrimitive -> ShowS # show :: ReasonPrimitive -> String # showList :: [ReasonPrimitive] -> ShowS # |
data ReasonDatatype Source #
Instances
Eq ReasonDatatype Source # | |
Defined in Reason.Type (==) :: ReasonDatatype -> ReasonDatatype -> Bool # (/=) :: ReasonDatatype -> ReasonDatatype -> Bool # | |
Show ReasonDatatype Source # | |
Defined in Reason.Type showsPrec :: Int -> ReasonDatatype -> ShowS # show :: ReasonDatatype -> String # showList :: [ReasonDatatype] -> ShowS # |
isEnumeration :: ReasonConstructor -> Bool Source #
Whether a set of constructors is an enumeration, i.e. whether they lack values. data A = A | B | C would be simple data A = A Int | B | C would not be simple.
primitiveName :: ReasonPrimitive -> Text Source #
toReasonTypeRefWith :: ReasonType a => Options -> a -> Text Source #
toReasonTypeRef :: ReasonType a => a -> Text Source #
toReasonTypeSourceWith :: ReasonType a => Options -> a -> Text Source #
toReasonTypeSource :: ReasonType a => a -> Text Source #
renderType :: ReasonType a => a -> RenderM () Source #
toReasonEncoderRefWith :: ReasonType a => Options -> a -> Text Source #
toReasonEncoderRef :: ReasonType a => a -> Text Source #
toReasonEncoderSourceWith :: ReasonType a => Options -> a -> Text Source #
toReasonEncoderSource :: ReasonType a => a -> Text Source #
renderEncoder :: ReasonType a => a -> RenderM () Source #
toReasonDecoderRefWith :: ReasonType a => Options -> a -> Text Source #
toReasonDecoderRef :: ReasonType a => a -> Text Source #
toReasonDecoderSourceWith :: ReasonType a => Options -> a -> Text Source #
toReasonDecoderSource :: ReasonType a => a -> Text Source #
renderDecoder :: ReasonType a => a -> RenderM () Source #