aeson-flowtyped-0.14.0: Create Flow or TypeScript type definitions from Haskell data types.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Aeson.Flow

Description

Derive Flow types using aeson Options.

Does not currently support the unwrapUnaryRecords option.

Synopsis

AST types

class Typeable a => FlowTyped a where Source #

Minimal complete definition

Nothing

Instances

Instances details
FlowTyped Value Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Void Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Int16 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Int32 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Int64 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Int8 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Word16 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Word32 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Word64 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Word8 Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped IntSet Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Scientific Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Text Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Text Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped UTCTime Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped String Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped () Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Bool Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Char Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Double Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Float Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Int Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped Word Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (IntMap a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (Set a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (Tree a) Source #

This instance is defined recursively. You'll probably need to use dependencies to extract a usable definition

Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (HashSet a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (Vector a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (Vector a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (Vector a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped (Maybe a) Source # 
Instance details

Defined in Data.Aeson.Flow

FlowTyped a => FlowTyped [a] Source # 
Instance details

Defined in Data.Aeson.Flow

(FlowTyped a, FlowTyped b) => FlowTyped (Either a b) Source # 
Instance details

Defined in Data.Aeson.Flow

(Typeable a, Typeable k) => FlowTyped (Fixed a) Source # 
Instance details

Defined in Data.Aeson.Flow

(FlowTyped k, FlowTyped a, ToJSONKey k) => FlowTyped (HashMap k a) Source # 
Instance details

Defined in Data.Aeson.Flow

(FlowTyped a, FlowTyped b) => FlowTyped (a, b) Source # 
Instance details

Defined in Data.Aeson.Flow

(FlowTyped a, ReifyFlowTyFields fs, Typeable fs, Typeable k) => FlowTyped (FlowTyFields a fs) Source # 
Instance details

Defined in Data.Aeson.Flow

(FlowTyped a, FlowTyped b, FlowTyped c) => FlowTyped (a, b, c) Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

flowType :: Proxy (a, b, c) -> FlowType Source #

flowTypeName :: Proxy (a, b, c) -> Maybe Text Source #

flowTypeVars :: Proxy (a, b, c) -> [Flowable] Source #

flowOptions :: Proxy (a, b, c) -> Options Source #

isPrim :: Proxy (a, b, c) -> Bool Source #

(FlowTyped a, FlowTyped b, FlowTyped c, FlowTyped d) => FlowTyped (a, b, c, d) Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

flowType :: Proxy (a, b, c, d) -> FlowType Source #

flowTypeName :: Proxy (a, b, c, d) -> Maybe Text Source #

flowTypeVars :: Proxy (a, b, c, d) -> [Flowable] Source #

flowOptions :: Proxy (a, b, c, d) -> Options Source #

isPrim :: Proxy (a, b, c, d) -> Bool Source #

(FlowTyped a, FlowTyped b, FlowTyped c, FlowTyped d, FlowTyped e) => FlowTyped (a, b, c, d, e) Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

flowType :: Proxy (a, b, c, d, e) -> FlowType Source #

flowTypeName :: Proxy (a, b, c, d, e) -> Maybe Text Source #

flowTypeVars :: Proxy (a, b, c, d, e) -> [Flowable] Source #

flowOptions :: Proxy (a, b, c, d, e) -> Options Source #

isPrim :: Proxy (a, b, c, d, e) -> Bool Source #

callType :: forall a. FlowTyped a => Proxy a -> FlowType Source #

data FlowTypeF a Source #

The main AST for flowtypes.

Instances

Instances details
Foldable FlowTypeF Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

fold :: Monoid m => FlowTypeF m -> m #

foldMap :: Monoid m => (a -> m) -> FlowTypeF a -> m #

foldMap' :: Monoid m => (a -> m) -> FlowTypeF a -> m #

foldr :: (a -> b -> b) -> b -> FlowTypeF a -> b #

foldr' :: (a -> b -> b) -> b -> FlowTypeF a -> b #

foldl :: (b -> a -> b) -> b -> FlowTypeF a -> b #

foldl' :: (b -> a -> b) -> b -> FlowTypeF a -> b #

foldr1 :: (a -> a -> a) -> FlowTypeF a -> a #

foldl1 :: (a -> a -> a) -> FlowTypeF a -> a #

toList :: FlowTypeF a -> [a] #

null :: FlowTypeF a -> Bool #

length :: FlowTypeF a -> Int #

elem :: Eq a => a -> FlowTypeF a -> Bool #

maximum :: Ord a => FlowTypeF a -> a #

minimum :: Ord a => FlowTypeF a -> a #

sum :: Num a => FlowTypeF a -> a #

product :: Num a => FlowTypeF a -> a #

Eq1 FlowTypeF Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

liftEq :: (a -> b -> Bool) -> FlowTypeF a -> FlowTypeF b -> Bool #

Show1 FlowTypeF Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> FlowTypeF a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [FlowTypeF a] -> ShowS #

Traversable FlowTypeF Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

traverse :: Applicative f => (a -> f b) -> FlowTypeF a -> f (FlowTypeF b) #

sequenceA :: Applicative f => FlowTypeF (f a) -> f (FlowTypeF a) #

mapM :: Monad m => (a -> m b) -> FlowTypeF a -> m (FlowTypeF b) #

sequence :: Monad m => FlowTypeF (m a) -> m (FlowTypeF a) #

Functor FlowTypeF Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

fmap :: (a -> b) -> FlowTypeF a -> FlowTypeF b #

(<$) :: a -> FlowTypeF b -> FlowTypeF a #

Show a => Show (FlowTypeF a) Source # 
Instance details

Defined in Data.Aeson.Flow

Eq a => Eq (FlowTypeF a) Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

(==) :: FlowTypeF a -> FlowTypeF a -> Bool #

(/=) :: FlowTypeF a -> FlowTypeF a -> Bool #

pattern FPrim :: PrimType -> FlowType Source #

pattern FTag :: Text -> FlowType Source #

Code generation

Wholesale ES6flowtypescript modules

data Export Source #

Instances

Instances details
Eq Export Source # 
Instance details

Defined in Data.Aeson.Flow

Methods

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

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

export :: forall a. FlowTyped a => Export Source #

data RenderMode Source #

Instances

Instances details
Show RenderMode Source # 
Instance details

Defined in Data.Aeson.Flow

Eq RenderMode Source # 
Instance details

Defined in Data.Aeson.Flow

data RenderOptions Source #

Constructors

RenderOptions 

Instances

Instances details
Show RenderOptions Source # 
Instance details

Defined in Data.Aeson.Flow

Eq RenderOptions Source # 
Instance details

Defined in Data.Aeson.Flow

data ModuleOptions Source #

Constructors

ModuleOptions 

Fields

Instances

Instances details
Show ModuleOptions Source # 
Instance details

Defined in Data.Aeson.Flow

Eq ModuleOptions Source # 
Instance details

Defined in Data.Aeson.Flow

showTypeAs :: RenderOptions -> Bool -> Text -> FlowType -> [Flowable] -> Text Source #

Generate a type declaration, possibly an export.

exportTypeAs :: RenderOptions -> Text -> FlowType -> [Flowable] -> Text Source #

Generate a export type declaration.

Convenience for generating flowtypes from other types

data FlowTyFields :: * -> [k] -> * where Source #

Useful for declaring flowtypes from type-level key/value sets, like

FlowTyFields :: FlowTyFields Person '['("name", String), '("email", String)]

Constructors

FlowTyFields :: FlowTyFields k fs 

Instances

Instances details
(FlowTyped a, ReifyFlowTyFields fs, Typeable fs, Typeable k) => FlowTyped (FlowTyFields a fs) Source # 
Instance details

Defined in Data.Aeson.Flow

type family FlowDeconstructField (k :: t) :: (Symbol, *) Source #

Instances

Instances details
type FlowDeconstructField ('(a, b) :: (Symbol, Type)) Source # 
Instance details

Defined in Data.Aeson.Flow

type FlowDeconstructField ('(a, b) :: (Symbol, Type)) = '(a, b)

TS specific

showTypeScriptType :: FlowType -> [Flowable] -> Text Source #

Pretty-print a flowtype in flowtype syntax

Flow specific

showFlowType :: FlowType -> [Flowable] -> Text Source #

Pretty-print a flowtype in flowtype syntax

Dependencies

dependencies :: FlowTyped a => Proxy a -> Set FlowName Source #

Compute all the dependencies of a FlowTyped thing, including itself.

Utility

data FlowName where Source #

A name for a flowtyped data-type. These are returned by dependencies.

Constructors

FlowName :: FlowTyped a => Proxy a -> Text -> FlowName 

Instances

Instances details
Show FlowName Source # 
Instance details

Defined in Data.Aeson.Flow

Eq FlowName Source # 
Instance details

Defined in Data.Aeson.Flow

Ord FlowName Source # 
Instance details

Defined in Data.Aeson.Flow

data Flowable where Source #

Constructors

Flowable :: FlowTyped a => Proxy a -> Flowable 

Instances

Instances details
Show Flowable Source # 
Instance details

Defined in Data.Aeson.Flow

Eq Flowable Source # 
Instance details

Defined in Data.Aeson.Flow

Ord Flowable Source # 
Instance details

Defined in Data.Aeson.Flow

defaultFlowTypeName :: (Generic a, Rep a ~ D1 ('MetaData name mod pkg t) c, KnownSymbol name) => Proxy a -> Maybe Text Source #