!I E8      !"#$%&'()*+,-./01234567Labels (polykinded, phantom)*(c) Juan Garca Garland, Marcos Viera 2020GPL-3jpgarcia@fing.edu.uy experimentalPOSIXSafe-.H$polykinded extensible record libraryB(c) Juan Garca Garland, Marcos Viera, 2019-2020GPLjpgarcia@fing.edu.uy experimentalPOSIXSafe&',-./1=>?@ACHSUVXgk?{!8poly-recExtension operator (inner)poly-recextension operator (wrapper)9poly-recupdate operator (internal)poly-recupdate operator (wrapper):poly-recDatatype for lookup (internal) poly-recDatatype for lookup (wrapper) poly-recQFunction to show the field of the record ("field named", "children", "tag:", etc) poly-rec<Function to show the name of records (Record, Mapping, etc):poly-recwcomparisson of Labels, this family is polykinded, each record-like structure must implement this family for its labelspoly-recThe inverse of poly-recQGiven a type of record and its index, it computes the type of record inhabitantspoly-recpoly-rec:Record data structure for generic records (Internal). The cg index indicates the kind of record (for each record instance, the user should define an index). The rJ index represents the mapping from labels to values. Labels are of kind k' . Values are still polykinded (k'') since rich information can be statically represented here (for instance, when a record of records, or a record of Vectors is represented). k' must implement the u family, although it is not visible here for simplicity. Records are built putting fields ordered according to the  result of its labels. 6This constructors are not intended to be used to build records, (6 is the problematic one). Use the smart constructors  emptyRecord and  instead. We export the constructors to pattern match on them. Although there are solutions to hide Constructors while supporting pattern matching, we kept it simplepoly-recDThe empty Record. Note that it is polymorphic on the kind of record c.poly-recTagField operator, note that c$ will be ambiguous if not annotated.poly-recThis is the destructor of . Note the use of  here.poly-rec Pretty lookuppoly-recThe update function. Given a  and value, and a Record containing this label, it updates the value. It could change its type. It raises a custom type error if there is no field labelled with l.poly-recThe lookup function. Given a  and a Recordn, it returns the field at that position. It raises a custom type error if there is no field labelled with l.poly-rec the pretty cons, hiding require;poly-recInstance for Symbolspoly-rec+error instance (looking up an empty record)poly-recERROR, we are beyond the supposed position for the label |l|, so we can assert there is no field labelled |l| (ot the record is ill-formed)poly-reclabel not {yet} found poly-rec label found!!poly-recwrapper instance"poly-recerror instance#poly-recERROR, we are beyond the supposed position for the label |l|, so we can assert there is no field labelled with |l| to update (or the record is ill-formed)%poly-rec label found&poly-recwrapper instance'poly-recextending an empty record*poly-rec keep looking+poly-recwrapper instancepoly-rec tags a value v$ with record and label information. v{ is polykinded, for instance we could be tagging some kind of record, because then we would build a matrix. In that case k'7 could be something as `[(kindforlabels, Type)]`. But > contains inhabited values, it tags values of a type of kind <q. In this example perhaps some value of type `Rec Something [(kindforlabels, Type)]`. That is the role of the  family. Given c, the kind of record, and v, ir computes the wrapper.poly-rec empty recordpoly-rec takes a tagged field (M) and a record, to build a new record. Recall that fields should be ordered.   42Safe&',-./1=>?@ACHSUVXgkE ,poly-rec index type-poly-recRecordsdatatype definition.poly-recPretty Constructor/poly-recFor the empty Record1poly-rec Get a label2poly-recLookup3poly-rec extension=poly-recType level show utilities>poly-rec field type,-./0123-,01.32/.42532?         !"#$%&'()*+,-./0123456789:;<=>?@'poly-rec-0.6.0.0-6AXKCfH6piSLvg3vkE7KzvData.GenRec.Label Data.GenRecData.GenRec.RecInstances.RecordLabelsndLabelfstLabel labelFromType proxyToLabelOpExtendOpUpdateOpLookup ShowFieldShowRecCmpUnWrap WrapFieldTagFieldRecEmptyRecConsRec emptyGenRec.=. untagField#updatelookup.*.$fRequireOpLookupctx$fRequireOpLookup'ctx$fRequireOpLookup'ctx0$fRequireOpLookup'ctx1$fRequireOpLookupctx0$fRequireOpUpdatectx$fRequireOpUpdate'ctx$fRequireOpUpdate'ctx0$fRequireOpUpdate'ctx1$fRequireOpUpdatectx0$fRequireOpExtendctx$fRequireOpExtend'ctx$fRequireOpExtend'ctx0$fRequireOpExtend'ctx1$fRequireOpExtendctx0RecoRecord.==. emptyRecorduntaggetLabel##.**. $fShowRec $fShowRec0 $fShowRec1$fShowTagField OpExtend' OpUpdate' OpLookup'D:R:CmpSymbolabghc-prim GHC.TypesTypeD:R:ShowRecRecoD:R:WrapFieldTYPETYPERecov