-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate ELM types/encoders/decoders from Haskell types. -- -- Please see the README on GitHub at -- https://github.com/sras/elminator#readme @package elminator @version 0.2.3.0 -- | Generate Elm type definitions, encoders and decoders from Haskell data -- types. module Elminator -- | Include the elm source for the Haskell type specified by the proxy -- argument. The second argument decides which components will be -- included and if the generated type will be polymorphic. include :: ToHType a => Proxy a -> GenOption -> Builder -- | Return the generated Elm code in a template haskell splice and -- optionally write to a Elm source file at the same time. The second -- argument is the Options type from Aeson library. Use include -- calls to build the Builder value. generateFor :: ElmVersion -> Options -> Maybe FilePath -> Builder -> Q Exp -- | Specify Elm version to generate code for data ElmVersion Elm0p18 :: ElmVersion Elm0p19 :: ElmVersion -- | This type holds the type information we get from generics. Only the -- HExternal constructor is supposed to be used by the programmer -- to implement ToHType instances for entites that are predefined -- in Elm. A sample can be seen below. -- -- Here, let `MyExtType a b` be a type which has the corresponding type, -- encoders and decoders predefined in Elm in a module named Lib. -- Here is how you can implement a ToHType instance for this type so that -- your other autogenerated types can have fields of type `MyExtType a -- b`. -- --
--   instance (ToHType a, ToHType b) => ToHType (MyExtType a b) where
--     toHType _ = do
--       ha <- toHType (Proxy :: Proxy a)
--       hb <- toHType (Proxy :: Proxy b)
--       pure $
--         HExternal
--           (ExInfo
--              (External, MyExtType)
--              (Just (External, "encodeMyExtType"))
--              (Just (External, "decodeMyExtType"))
--              [ha, hb])
--   
data HType HUDef :: UDefData -> HType HMaybe :: HType -> HType HList :: HType -> HType HPrimitive :: MData -> HType HRecursive :: MData -> HType HExternal :: ExInfo HType -> HType class ToHType f toHType :: ToHType f => Proxy f -> HState HType toHType :: (ToHType f, ToHTArgs (ExtractTArgs f), Generic f, ToHType_ (Rep f)) => Proxy f -> HState HType data ExInfo a ExInfo :: ExItem -> Maybe ExItem -> Maybe ExItem -> [a] -> ExInfo a [exType] :: ExInfo a -> ExItem [exEncoder] :: ExInfo a -> Maybe ExItem [exDecoder] :: ExInfo a -> Maybe ExItem [exTypeArgs] :: ExInfo a -> [a] type Builder = State GenConfig () -- | Decides which among type definiton, encoder and decoder will be -- included for a type. The poly config value decides wether the included -- type definition will be polymorphic. data GenOption Definiton :: PolyConfig -> GenOption EncoderDecoder :: GenOption Everything :: PolyConfig -> GenOption -- | Decides wether the type definition will be polymorphic. data PolyConfig Mono :: PolyConfig Poly :: PolyConfig