-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Derive Elm types and Json code from Haskell types, using aeson's options
--   
--   Building the bridge from Haskell to Elm and back. Define types once,
--   and derive the aeson and elm functions at the same time, using any
--   aeson option you like. Cheers!
@package elm-bridge
@version 0.8.4

-- | This module defines how the derived Haskell data types are
--   represented. - It is useful for writing type conversion rules.
module Elm.TyRep

-- | Type definition, including constructors.
data ETypeDef
ETypeAlias :: EAlias -> ETypeDef
ETypePrimAlias :: EPrimAlias -> ETypeDef
ETypeSum :: ESum -> ETypeDef

-- | Type construction : type variables, type constructors, tuples and type
--   application.
data EType
ETyVar :: ETVar -> EType
ETyCon :: ETCon -> EType
ETyApp :: EType -> EType -> EType
ETyTuple :: Int -> EType

-- | Type constructor:
--   
--   
--   ETCon "Int"
--   
newtype ETCon
ETCon :: String -> ETCon
[tc_name] :: ETCon -> String

-- | Type variable:
--   
--   
--   ETVar "a"
--   
newtype ETVar
ETVar :: String -> ETVar
[tv_name] :: ETVar -> String

-- | Type name:
--   
--   
--   ETypeName "Map" [ETVar "k", ETVar "v"]
--   
data ETypeName
ETypeName :: String -> [ETVar] -> ETypeName
[et_name] :: ETypeName -> String
[et_args] :: ETypeName -> [ETVar]
data EPrimAlias
EPrimAlias :: ETypeName -> EType -> EPrimAlias
[epa_name] :: EPrimAlias -> ETypeName
[epa_type] :: EPrimAlias -> EType
data EAlias
EAlias :: ETypeName -> [(String, EType)] -> Bool -> Bool -> Bool -> EAlias
[ea_name] :: EAlias -> ETypeName
[ea_fields] :: EAlias -> [(String, EType)]
[ea_omit_null] :: EAlias -> Bool
[ea_newtype] :: EAlias -> Bool
[ea_unwrap_unary] :: EAlias -> Bool
data SumTypeFields
Anonymous :: [EType] -> SumTypeFields
Named :: [(String, EType)] -> SumTypeFields
isNamed :: SumTypeFields -> Bool
isEmpty :: SumTypeFields -> Bool
data SumTypeConstructor
STC :: String -> String -> SumTypeFields -> SumTypeConstructor
[_stcName] :: SumTypeConstructor -> String
[_stcEncoded] :: SumTypeConstructor -> String
[_stcFields] :: SumTypeConstructor -> SumTypeFields
data ESum
ESum :: ETypeName -> [SumTypeConstructor] -> SumEncoding' -> Bool -> Bool -> ESum
[es_name] :: ESum -> ETypeName
[es_constructors] :: ESum -> [SumTypeConstructor]
[es_type] :: ESum -> SumEncoding'
[es_omit_null] :: ESum -> Bool
[es_unary_strings] :: ESum -> Bool

-- | Transforms tuple types in a list of types. Otherwise returns a
--   singleton list with the original type.
unpackTupleType :: EType -> [EType]
unpackToplevelConstr :: EType -> [EType]
class IsElmDefinition a
compileElmDef :: IsElmDefinition a => Proxy a -> ETypeDef
newtype SumEncoding'
SumEncoding' :: SumEncoding -> SumEncoding'
defSumEncoding :: SumEncoding'

-- | Get an elm-bridge type representation for a Haskell type.
--   This can be used to render the type declaration via
--   ElmRenderable or the the JSON serializer/parser names via
--   jsonSerForType and jsonParserForType.
toElmType :: Typeable a => Proxy a -> EType
instance GHC.Classes.Eq Elm.TyRep.EAlias
instance GHC.Classes.Eq Elm.TyRep.EPrimAlias
instance GHC.Classes.Eq Elm.TyRep.ESum
instance GHC.Classes.Eq Elm.TyRep.ETCon
instance GHC.Classes.Eq Elm.TyRep.ETVar
instance GHC.Classes.Eq Elm.TyRep.EType
instance GHC.Classes.Eq Elm.TyRep.ETypeDef
instance GHC.Classes.Eq Elm.TyRep.ETypeName
instance GHC.Classes.Eq Elm.TyRep.SumEncoding'
instance GHC.Classes.Eq Elm.TyRep.SumTypeConstructor
instance GHC.Classes.Eq Elm.TyRep.SumTypeFields
instance GHC.Classes.Ord Elm.TyRep.EAlias
instance GHC.Classes.Ord Elm.TyRep.EPrimAlias
instance GHC.Classes.Ord Elm.TyRep.ESum
instance GHC.Classes.Ord Elm.TyRep.ETCon
instance GHC.Classes.Ord Elm.TyRep.ETVar
instance GHC.Classes.Ord Elm.TyRep.EType
instance GHC.Classes.Ord Elm.TyRep.ETypeName
instance GHC.Classes.Ord Elm.TyRep.SumEncoding'
instance GHC.Classes.Ord Elm.TyRep.SumTypeConstructor
instance GHC.Classes.Ord Elm.TyRep.SumTypeFields
instance GHC.Internal.Show.Show Elm.TyRep.EAlias
instance GHC.Internal.Show.Show Elm.TyRep.EPrimAlias
instance GHC.Internal.Show.Show Elm.TyRep.ESum
instance GHC.Internal.Show.Show Elm.TyRep.ETCon
instance GHC.Internal.Show.Show Elm.TyRep.ETVar
instance GHC.Internal.Show.Show Elm.TyRep.EType
instance GHC.Internal.Show.Show Elm.TyRep.ETypeDef
instance GHC.Internal.Show.Show Elm.TyRep.ETypeName
instance GHC.Internal.Show.Show Elm.TyRep.SumEncoding'
instance GHC.Internal.Show.Show Elm.TyRep.SumTypeConstructor
instance GHC.Internal.Show.Show Elm.TyRep.SumTypeFields

-- | This module should be used to derive the Elm instance alongside the
--   JSON ones. The prefered usage is to convert statements such as :
--   
--   
--   $(deriveJSON defaultOptions{fieldLabelModifier = drop 4, constructorTagModifier = map toLower} ''D)
--   
--   
--   into:
--   
--   
--   $(deriveBoth defaultOptions{fieldLabelModifier = drop 4, constructorTagModifier = map toLower} ''D)
--   
--   
--   Which will derive both the aeson and elm-bridge
--   instances at the same time.
module Elm.Derive
data Options
data SumEncoding
TaggedObject :: String -> String -> SumEncoding
[tagFieldName] :: SumEncoding -> String
[contentsFieldName] :: SumEncoding -> String
UntaggedValue :: SumEncoding
ObjectWithSingleField :: SumEncoding
TwoElemArray :: SumEncoding

-- | Note that This default set of options is distinct from that in the
--   aeson package.
defaultOptions :: Options

-- | This generates a default set of options. The parameter represents the
--   number of characters that must be dropped from the Haskell field
--   names. The first letter of the field is then converted to lowercase,
--   ie:
--   
--   
--   data Foo = Foo { _fooBarQux :: Int }
--   $(deriveBoth (defaultOptionsDropLower 4) ''Foo)
--   
--   
--   Will be encoded as:
--   
--   
--   {"barQux"=12}
--   
defaultOptionsDropLower :: Int -> Options

-- | Just derive the elm-bridge definitions for generating the
--   serialization/deserialization code. It must be kept synchronized with
--   the Haskell code manually.
deriveElmDef :: Options -> Name -> Q [Dec]

-- | Equivalent to running both deriveJSON and deriveElmDef
--   with the same options, so as to ensure the code on the Haskell and Elm
--   size is synchronized.
deriveBoth :: Options -> Name -> Q [Dec]

-- | This module should not usually be imported.
module Elm.TyRender
class ElmRenderable a
renderElm :: ElmRenderable a => a -> String
instance Elm.TyRender.ElmRenderable Elm.TyRep.EAlias
instance Elm.TyRender.ElmRenderable Elm.TyRep.EPrimAlias
instance Elm.TyRender.ElmRenderable Elm.TyRep.ESum
instance Elm.TyRender.ElmRenderable Elm.TyRep.ETCon
instance Elm.TyRender.ElmRenderable Elm.TyRep.ETVar
instance Elm.TyRender.ElmRenderable Elm.TyRep.EType
instance Elm.TyRender.ElmRenderable Elm.TyRep.ETypeDef
instance Elm.TyRender.ElmRenderable Elm.TyRep.ETypeName

-- | This module implements a generator for JSON serialisers and parsers of
--   arbitrary elm types.
--   
--   It is highly recommended to either only use the functions of
--   Elm.Module, or to use the functions in this module after having
--   modified the ETypeDef arguments with functions such as
--   defaultAlterations.
--   
--   The reason is that Elm types might have an equivalent on the Haskell
--   side and should be converted (ie. Text -> String,
--   Vector -> []).
module Elm.Json

-- | Compile a JSON parser for an Elm type definition
jsonParserForDef :: ETypeDef -> String

-- | Compile a JSON serializer for an Elm type definition
jsonSerForDef :: ETypeDef -> String

-- | Compile a JSON parser for an Elm type
jsonParserForType :: EType -> String

-- | Compile a JSON serializer for an Elm type.
--   
--   The omitNothingFields option is currently not implemented!
jsonSerForType :: EType -> String

-- | Serialize a type like 'type Color = Red | Green | Blue' in a function
--   like
--   
--   
--   stringEncColor : Color -> String
--   stringEncColor x =
--     case x of
--       Red -> "red"
--       ...
--   
--   
--   This is mainly useful for types which are used as part of query
--   parameters and url captures.
stringSerForSimpleAdt :: ETypeDef -> String

-- | Parse a String into a maybe-value for simple ADT types. See
--   stringSerForSimpleAdt for motivation
stringParserForSimpleAdt :: ETypeDef -> String
instance GHC.Classes.Eq Elm.Json.MaybeHandling

-- | A type to represent versions of Elm for produced code to work against.
--   
--   This module only supports Elm 0.19.x !!!
module Elm.Versions
data ElmVersion
Elm0p19 :: ElmVersion

-- | Functions in this module are used to generate Elm modules. Note that
--   the generated modules depend on the bartavelle/json-helpers
--   package.
module Elm.Module

-- | Existential quantification wrapper for lists of type definitions
data DefineElm
DefineElm :: Proxy a -> DefineElm

-- | The module header line for this version of Elm
moduleHeader :: ElmVersion -> String -> String

-- | Creates an Elm module for the given version. This will use the default
--   type conversion rules (to -- convert Vector to List,
--   HashMap a b to List (a,b), etc.).
makeElmModuleWithVersion :: ElmVersion -> String -> [DefineElm] -> String

-- | Creates an Elm module. This will use the default type conversion rules
--   (to convert Vector to List, HashMap a b to
--   List (a,b), etc.).
--   
--   default to 0.19
makeElmModule :: String -> [DefineElm] -> String

-- | Generates the content of a module. You will be responsible for
--   including the required Elm headers. This uses the default type
--   conversion rules.
makeModuleContent :: [DefineElm] -> String

-- | Generates the content of a module, using custom type conversion rules.
makeModuleContentWithAlterations :: (ETypeDef -> ETypeDef) -> [DefineElm] -> String

-- | A helper function that will recursively traverse type definitions and
--   let you convert types.
--   
--   
--   myAlteration : ETypeDef -> ETypeDef
--   myAlteration = recAlterType $ \t -> case t of
--                     ETyCon (ETCon "Integer") -> ETyCon (ETCon "Int")
--                     ETyCon (ETCon "Text")    -> ETyCon (ETCon "String")
--                     _                        -> t
--   
recAlterType :: (EType -> EType) -> ETypeDef -> ETypeDef

-- | Given a list of type names, will newtype all the matching
--   type definitions.
newtypeAliases :: [String] -> ETypeDef -> ETypeDef

-- | A default set of type conversion rules:
--   
--   
--   
- HashSet a, Set a -> if a is
--   comparable, then Set a, else List a
--   
- HashMap String v, Map String v -> Dict
--   String v
--   
- HashMap k v, Map k v -> List (k,
--   v)
--   
- Integer -> Int
--   
- Text -> String
--   
- Vector -> List
--   
- Double -> Float
--   
- Tagged t v -> v
--   
defaultAlterations :: ETypeDef -> ETypeDef
defaultTypeAlterations :: EType -> EType
