moduleGraphics.Vty.Widgets.Util(on,fgColor,bgColor,style,mergeAttr,mergeAttrs,withWidth,withHeight,plusWidth,plusHeight,remove,inject,repl)whereimportData.WordimportGraphics.Vty-- |Infix attribute constructor. Use: foregroundColor `on`-- backgroundColor.on::Color->Color->Attronab=def_attr`with_back_color`b`with_fore_color`a-- |Foreground-only attribute constructor. Background color and style-- are defaulted.fgColor::Color->AttrfgColor=(def_attr`with_fore_color`)-- |Background-only attribute constructor. Foreground color and style-- are defaulted.bgColor::Color->AttrbgColor=(def_attr`with_back_color`)-- |Style-only attribute constructor. Colors are defaulted.style::Style->Attrstyle=(def_attr`with_style`)-- Left-most attribute's fields take precedence.-- |Merge two attributes. Leftmost attribute takes precedence where-- it specifies any of the foreground color, background color, or-- style. Note that the style precedence is total: all bits of the-- style mask will take precedence if any are set.mergeAttr::Attr->Attr->AttrmergeAttrab=letb1=caseattr_styleaofSetTov->b{attr_style=SetTov}_->bb2=caseattr_fore_coloraofSetTov->b1`with_fore_color`v_->b1b3=caseattr_back_coloraofSetTov->b2`with_back_color`v_->b2inb3-- |List fold version of 'mergeAttr'.mergeAttrs::[Attr]->AttrmergeAttrsattrs=foldrmergeAttrdef_attrattrs-- |Modify the width component of a 'DisplayRegion'.withWidth::DisplayRegion->Word->DisplayRegionwithWidth(DisplayRegion_h)w=DisplayRegionwh-- |Modify the height component of a 'DisplayRegion'.withHeight::DisplayRegion->Word->DisplayRegionwithHeight(DisplayRegionw_)h=DisplayRegionwh-- |Modify the width component of a 'DisplayRegion'.plusWidth::DisplayRegion->Word->DisplayRegionplusWidth(DisplayRegionw'h)w=if(fromEnumw'+fromEnumw<0)thenerror$"plusWidth: would overflow on "++(showw')++" + "++(showw)elseDisplayRegion(w+w')h-- |Modify the height component of a 'DisplayRegion'.plusHeight::DisplayRegion->Word->DisplayRegionplusHeight(DisplayRegionwh')h=if(fromEnumh'+fromEnumh<0)thenerror$"plusHeight: would overflow on "++(showh')++" + "++(showh)elseDisplayRegionw(h+h')remove::Int->[a]->[a]removeposas=(takeposas)++(drop(pos+1)as)inject::Int->a->[a]->[a]injectposaas=let(h,t)=splitAtposasinh++(a:t)repl::Int->a->[a]->[a]replposaas=injectposa(removeposas)