Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file fancy.ml
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697type'at=Pretty.t->'a->Pretty.ttype('ty,'v)order=|Const:'at*'a->('v,'v)order|Atom:'at->('a->'v,'v)order|Param:('at->'a->'v,'v)order|New_line:('v,'v)order|Open:Pretty.box->('v,'v)order|Close:('v,'v)order|Break:(int*int)->('v,'v)orderletkeval_order:typetyv.(Pretty.t->v)->Pretty.t->(ty,v)order->ty=funkt->function|Const(encoder,v)->k(encodertv)|Atomencoder->funv->k(encodertv)|Param->funencoderv->k(encodertv)|New_line->Pretty.kpushkPretty.new_linet|Openbox->Pretty.kpushk(Pretty.obox)t|Close->Pretty.kpushkPretty.closet|Break(len,indent)->Pretty.kpushk(Pretty.break~len~indent)tletconstencoderv=Const(encoder,v)letatomencoder=Atomencoderleta=Paramlet(!!)=atomlet($)=constletnew_line=New_linelettboxindent=Open(Pretty.tboxindent)letbbox=OpenPretty.bboxletbox=OpenPretty.boxletclose=Closeletbreak~indent~len=Break(indent,len)letfws=Break(1,1)letspacesn=Break(n,0)letcut=Break(0,1)letusing:('b->'a)->'at->'bt=funfencodertv->encodert(fv)letlist~sep:(sep,e)encoder=letrecgot=function|[]->t|[x]->encodertx|x::r->lett=encodertxinlett=septeingotringoletoptionencodert=function|Somex->encodertx|None->tletchar:chart=funtx->(* XXX(dinosaure): we should optimize it! *)letatom=Pretty.string~breakable:false(String.make1x)inPretty.pushatomtletstring:stringt=funtx->letatom=Pretty.string~breakable:falsexinPretty.pushatomtletbytes:Bytes.tt=funtx->letatom=Pretty.bytes~breakable:falsexinPretty.pushatomtletbigstring:Bigstringaf.tt=funtx->letatom=Pretty.bigstring~breakable:falsexinPretty.pushatomtletbreakable:stringt=funtx->letatom=Pretty.string~breakable:truexinPretty.pushatomttype('ty,'v)fmt=|[]:('v,'v)fmt|(::):('x,'v)order*('v,'r)fmt->('x,'r)fmtletrecconcat:typeabc.(a,b)fmt->(b,c)fmt->(a,c)fmt=funl1l2->matchl1,l2with|[],l->l|h::t,l->h::concattlletreckeval:typetyv.(Pretty.t->v)->Pretty.t->(ty,v)fmt->ty=funkt->function|[]->kt|x::r->letkt=kevalktrinkeval_orderktxexternalidentity:'a->'a="%identity"leteval:typety.Pretty.t->(ty,Pretty.t)fmt->ty=funtfmt->kevalidentitytfmt