-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Template haskell utilities for helping with deserialization etc. of existential types -- -- instance-map provides Template Haskell functions that help go from -- serialized values with value-level type witnesses (i.e. TypeRep -- values) to existential types containing type-level evidence of -- membership in a type class. It is useful for dealing with serialized -- values when only membership in a certain class (and not the -- monomorphic type) is known at the site of deserialization. @package instance-map @version 0.1.0.0 module Type.InstanceMap.TH -- | When used as a declaration splice, this function will create three -- declarations: -- --
-- Map TypeRep InputType -> Some Class ---- --
-- TypeRep -> InputType -> Maybe (Some Class) ---- -- The four arguments to this function are: -- --
-- $(mkMap ''MyClass ''Value ''Result [|fromJSON|]) --mkMap :: ClassName -> InputTypeName -> OutputWrapperName -> ExpQ -> Q [Dec] -- | Like mkMap but with user-provided Options mkMapWithOpts :: Options -> ClassName -> InputTypeName -> OutputWrapperName -> ExpQ -> Q [Dec] defaultOptions :: Options type ClassName = Name type InputTypeName = Name type OutputWrapperName = Name data Options Options :: Int -> Bool -> ExpQ -> Name -> Options -- | How deep to traverse the tree of instance contexts when attempting to -- find monomorphic types that are members of the class. Default is 2. -- -- For instance, if we have declarations like: -- --
-- data NumWithS n = NumWithS String n -- instance (Num a) => Num (NumWithS a) ---- -- with maxDepth set to 2, then NumWithS Int and NumWithS (NumWithS Int) -- would both be found but NumWithS (NumWithS (NumWithS Int)) would not -- be. [maxDepth] :: Options -> Int -- | Whether to produce lots of debugging output. Default False. [verbose] :: Options -> Bool [witnessGenerator] :: Options -> ExpQ [witnessTypeName] :: Options -> Name module Type.InstanceMap