!      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe=?@A model%Any type can be converted to itself.    Safe=>?@AmodelA list of error messagesmodel]errorsToConvertResult (const (Left ["Bad format","Invalid value"])) ".." :: ConvertResult IntLeft (ConvertError {convSourceValue = "\"..\"", convSourceType = "[Char]", convDestType = "Int", convErrorMessage = "Bad format, Invalid value"})modelimport Data.Word'convertOrError 'a' :: Either Error WordRight 974convertOrError (1E50::Double) :: Either Error Word64Left "Convertible: error converting source data 1.0e50 of type Double to type Word64: Input value outside of bounds: (0,18446744073709551615)"model$Prefix errors with a contextual notemodel/Prefix a list of strings with a contextual note$inContext "0/0" ["Zero denominator"]["In 0/0: Zero denominator"]modelFIntercalate a dot between the non empty elements of a list of strings. dotted []""dotted ["","bc","de"]"bc.de"dotted ["bc","","de"]"bc.de"  Safe 45679=?@AaR/ model Simple name"modelA fully qualified Haskell name'modelA reference to a type(model Type variable)modelType reference*model>Another representation of a type, sometime easier to work with,modelA type-modelType constructor (Bool,Maybe,..).modelType application0model+Constructors are assembled in a binary tree2modelConstructor tree.GConstructors are disposed in an optimally balanced, right heavier tree:For example, the data type: (data N = One | Two | Three | Four | Five9Would have its contructors ordered in the following tree: K | | | One Two Three | Four Five7To get a list of constructor in declaration order, use E3model-The constructor name, unique in the data type4model{Constructor fields, they can be either unnamed (Left case) or named (Right case) If they are named, they must all be named5model(Simple algebraic data type (not a GADT)::declName: type used to represent the name of the data type:consName: type used to represent the name of a constructorwref: type used to represent a reference to a type or a type variable inside the data type definition (for example ?)7model'The name of the data type (for example Bool for  data Bool)8model?The number of type parameters/variable (up to a maximum of 255)9modelThe constructors, if present:modeleA map of all the ADTs that are directly or indirectly referred by a type, indexed by a type reference;modelKThe complete model of a type, a reference to the type plus its environment:8adtName: type used to represent the name of a data type:consName: type used to represent the name of a constructorwinRef: type used to represent a reference to a type or a type variable inside the data type definition (for example ?)UexRef: type used to represent a reference to a type in the type name (for example ")=model.The type application corresponding to the type>model,The environment in which the type is defined?modelReference to an Haskell Type@model Haskell TypeAmodel Haskell ADTBmodelHaskell TypeModelCmodelHaskell EnvironmentDmodel!The ADTs defined in the TypeModelEmodel3Return the list of constructors in definition orderFmodelDConvert a (possibly empty) list of constructors in (maybe) a ConTreeGmodelReturn just the field typesHmodel=Return just the field names (or an empty list if unspecified)Imodel?Return the binary encoding and parameter types of a constructorThe binary encoding is the sequence of Left (False) and Right (True) turns needed to reach the constructor from the constructor tree rootJmodelJMap on the constructor types (used for example when eliminating variables)Kmodel!Map over a constructor tree namesLmodel"Fold over a constructor tree namesMmodel+Extract list of types in a constructor treeNmodel)Fold over the types in a constructor treeOmodel4Map over the names of an ADT and of its constructorsPmodelConvert from Type to TypeNQmodelConvert from TypeN to TypeRmodel!Returns the list of nested TypeNs4nestedTypeNs $ TypeN "F" [TypeN "G" [],TypeN "Z" []]A[TypeN "F" [TypeN "G" [],TypeN "Z" []],TypeN "G" [],TypeN "Z" []]LnestedTypeNs $ TypeN "F" [TypeN "G" [TypeN "H" [TypeN "L" []]],TypeN "Z" []][TypeN "F" [TypeN "G" [TypeN "H" [TypeN "L" []]],TypeN "Z" []],TypeN "G" [TypeN "H" [TypeN "L" []]],TypeN "H" [TypeN "L" []],TypeN "L" [],TypeN "Z" []]SmodeloRemove variable references (for example if we know that a type is fully saturated and cannot contain variables)TmodelExtract referenceUmodel2Return the qualified name, minus the package name.GqualName (QualName {pkgName = "ab", mdlName = "cd.ef", locName = "gh"}) "cd.ef.gh"modelConvert a String to a " , if possibleasQualName "ab.cd.ef.gh"FSuccess (QualName {pkgName = "ab", mdlName = "cd.ef", locName = "gh"})asQualName "ab.cd.ef"CSuccess (QualName {pkgName = "ab", mdlName = "cd", locName = "ef"})asQualName "ab.cd"ASuccess (QualName {pkgName = "", mdlName = "ab", locName = "cd"})asQualName "ab"?Success (QualName {pkgName = "", mdlName = "", locName = "ab"}) asQualName "" Failure ["Empty qualified name"]asQualName "." Failure ["Empty qualified name"][The conversion assumes that the input String is a well-formed Haskell fully qualified name.6It will produce funny results if this is not the case:asQualName "**.&&.!!"CSuccess (QualName {pkgName = "**", mdlName = "&&", locName = "!!"})VmodelESolve all references in a data structure, using the given environmentWmodelESolve a key in an environment, returns an error if the key is missing      !"#$%&'()*+,-./01234 !"#$%&'()*+,-./0124356789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW:;<=>:D5678901243/,-.*+R'() !"#$%&UOPQFEIKLJMNGHCBA@?WVSTSafeUVj8model&Environment used while capturing model5modelThe stack of entered types6modelThe environmentmodel#Run the model capturing computationmodel Enter a type7modelYReturns True if we have already seen this data type and do not need to analyse it furthermodel,Add a new data type model to the environmentmodelLeave current typeSafe=>?pmodelcCompact representation: a value enveloped in CompactPretty will have only its first lines displayedmodel.Convert a variable number (0,1,..) to a name (a,b,..)model.Convert a variable number (0,1,..) to a name (a,b,..)modelIntercalate with a spacemodelIntercalate with a new linemodelEIntercalate a dot between the non empty elements of a list of strings  Safe .HUVXsRmodel Envelope to get Nats with * kindmodel*Convert a Nat to the corresponding IntegeranatVal (undefined::A5)5.89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXY Safe-.HUVwmodel A data typemodelType applicationmodel8Abstract a concrete type to a type applied to variables.RMore precisely: to a meta-representation where type application is represented by , data types are marked by " and variables are represented by  types.vBUG: Silently fails for types with more than 9 parameters (should be defined recursively, if you know how let me know) Examples::kind! Ana (Maybe Bool)Ana (Maybe Bool) :: *!= App (Typ (Maybe A0)) (Typ Bool):kind! Ana (Maybe Char)Ana (Maybe Char) :: * != App (Typ (Maybe A0)) (Typ Char)$:kind! Ana (Either Int (Maybe Bool))"Ana (Either Int (Maybe Bool)) :: *= App( (App (Typ (Either A0 A1)) (Typ Int))% (App (Typ (Maybe A0)) (Typ Bool)):kind! Ana ([(Bool,())])Ana ([(Bool,())]) :: * ?= App (Typ [A0]) (App (App (Typ (A0, A1)) (Typ Bool)) (Typ ()))189:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYSafe 8=>?UVX\ ZmodelbHelper class, uses Generics to capture the model of a data type Adapted from the Beamable packagemodelClass of types whose model can be calculated Instances are derived automatically, provided that the data type has an instance for   modeleGiven a type proxy, update the environment with the ADTs referred by it and return the corresponding @model0Helper class used to capture the type parametersmodel#Return the model for the given typemodelUse the given constructors tree as model for the given type, returns the build type Exported so that it can be used to overwrite default definitionsmodel Constructorsmodel$Datatypes with multiple constructorsmodel>Needed to avoid overlapping instances with (M1 D d (M1 C c a))modelyDatatypes with single constructor only instance (GModel a, Datatype d, Constructor c) => GModel (M1 D d (M1 C c a)) wheremodel6TypeLits are used to represent data type's parameters. Safe Safe      !"#$%&'()*+,-./01234  !"#$%&'()*+,-./0124356789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW[   !" !# !$ !% !&'()*+,-./012334456789:;;<=>?@A@BCDDEFGHIIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                             ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5678 9: ;<=>?=>@ 9A 9B 9C 9D 9E ;F 9G 9H 9I 9J ;K ;L ;M ;N ;O ;P ;Q ;R ;S ;T ;T ;U ;V ;W ;X ;Y 9Z 9[ 9[ 9\]^ model-0.5-9pTavxk2UCWIOTiByR8qw8Data.Model.TypesData.Convertible.TinyData.Model.EnvData.Model.PrettyData.Model.Util Type.ANat Type.AnalyseData.Model.ClassData.Model.InstancesGHCGenerics Data.Modelbase Data.ProxyProxy*convertible-1.1.1.0-7i96jmLhDws8ECMxJRs7xMData.Convertible.BaseprettyConvertError convErrorconvert ConvertResult safeConvert ConvertibleconvErrorMessage convDestTypeconvSourceTypeconvSourceValue ConvertErrortransformers-0.5.5.0Control.Monad.Trans.State.LazyStatepretty-1.1.3.6Text.PrettyPrint.HughesPJClass prettyShow pPrintListpPrint pPrintPrecPretty$fConvertibleaaErrorstoErrorsnoErrorserrorToConvertResulterrorsToConvertResultconvertOrErrorconvertResultToErrorconvertResultToErrors errsInContext inContextdottedNameQualNamepkgNamemdlNamelocNameTypeRefTypVarTypRefTypeNTypeTypeConTypeAppFieldsConTreeCon constrName constrFieldsADTdeclNamedeclNumParametersdeclConsTypeEnv TypeModeltypeNametypeEnvHTypeRefHTypeHADT HTypeModelHTypeEnvtypeADTs constructorscontree fieldsTypes fieldsNamesconstructorInfoconTreeTypeMapconTreeNameMapconTreeNameFoldconTreeTypeListconTreeTypeFoldMap adtNamesMaptypeNtypeA nestedTypeNsunVargetHRefqualNamesolveAllsolve$fTraversableConTree$fFoldableConTree$fFunctorConTree$fConvertibleQualName[]$fConvertible[]QualName$fEqType $fOrdType $fShowType $fNFDataType $fGenericType $fFunctorType$fFoldableType$fTraversableType $fEqConTree $fOrdConTree $fShowConTree$fNFDataConTree$fGenericConTree$fEqADT$fOrdADT $fShowADT $fNFDataADT $fGenericADT $fFunctorADT $fFoldableADT$fTraversableADT $fEqTypeModel$fOrdTypeModel$fShowTypeModel$fNFDataTypeModel$fGenericTypeModel $fEqTypeN $fOrdTypeN $fReadTypeN $fShowTypeN $fNFDataTypeN$fGenericTypeN$fFunctorTypeN$fFoldableTypeN$fTraversableTypeN $fEqTypeRef $fOrdTypeRef $fShowTypeRef$fNFDataTypeRef$fGenericTypeRef$fFunctorTypeRef$fFoldableTypeRef$fTraversableTypeRef $fEqQualName $fOrdQualName$fShowQualName$fNFDataQualName$fGenericQualName$fEqName $fOrdName $fShowName $fNFDataName $fGenericNameEnvwithEnventerCtxaddDefcloseCtx $fShowEnv CompactPretty prettyADTvarPvarCspacedPvspacedPdottedP $fPrettyDoc $fPrettyName$fPrettyQualName $fPrettyTypeN $fPrettyType$fPrettyTypeRef$fPrettyEither $fPretty(,)$fPrettyConTree $fPrettyADT$fPrettyTypeModel$fPrettyCompactPretty$fPrettyPrettyTypeA9A8A7A6A5A4A3A2A1A0ANatanatValTypAppAnaModelenvTypeAsTypeasType typeModeluseCT $fAsTypeApp $fGModelU1 $fGModel:*: $fGModelM1 $fGModel:+: $fGModelM10 $fGModelM11 $fGModelM12 $fGModelM13 $fGModelK1 $fModelANat $fAsTypeTyp $fModelEither $fModelMaybe $fModelBool asQualName GHC.GenericsGenericRepfromtoGeneric1Rep1from1to1Datatype datatypeName moduleName packageName isNewtype ConstructorconName conFixity conIsRecordSelectorselNameselSourceUnpackednessselSourceStrictnessselDecidedStrictnessV1U1Par1unPar1Rec1unRec1K1unK1M1unM1:+:L1R1:*::.:Comp1unComp1RDCSRec0D1C1S1URecUAddrUCharUDoubleUFloatUIntUWorduWord#uInt#uFloat#uDouble#uChar#uAddr#precFixityPrefixInfixFixityIPrefixIInfixI AssociativityLeftAssociativeRightAssociativeNotAssociativeSourceUnpackedness SourceUnpackSourceNoUnpackNoSourceUnpackednessSourceStrictness SourceLazy SourceStrictNoSourceStrictnessDecidedStrictness DecidedLazy DecidedStrict DecidedUnpackMetaMetaDataMetaConsMetaSelctxenvinCtx GHC.TypeNatsKnownNat GHC.TypeLits KnownSymbolghc-prim GHC.TypesNatSymbol+*^<=?- CmpSymbolCmpNatDivModLog2 TypeError AppendSymbol sameSymbol someSymbolVal someNatVal symbolVal'natVal' symbolValnatVal SomeSymbol ErrorMessageText:<>::$$:ShowTypesameNatSomeNat<=GModel