úÎV!PÞF      !"#$%&'()*+,-./0123456789:;<=>?@ABCDE SafeºThe accessor function we use, has a record value as first argument and returns the content of a specific record field and a function that allows to overwrite that field with a new value.rIn former version of a package we used a function that resembled the state monad. However this required to use an F in the implementation of the get function.GHIJKGHIJGHIJKSafeIf an object is wrapped in a newtype, you can generate an Accessorÿ) to the unwrapped data by providing a wrapper and an unwrapper function. The set function is simpler in this case, since no existing data must be kept. Since the information content of the wrapped and unwrapped data is equivalent, you can swap wrapper and unwrapper. This way you can construct an Accessord that treats a record field containing an unwrapped object like a field containing a wrapped object. Qnewtype A = A {unA :: Int} access :: Accessor.T A Int access = fromWrapper A unA(We could also have called this function  fromBijection, since it must hold wrap . unwrap = id and unwrap . wrap = id.Access the record itself(Access a (non-existing) element of type ()result a/ accesses the value of a function for argument a‘. It is not very efficient to build a function from setting all of its values using this accessor, since every access to a function adds another  if-then-else.jAlso see semantic editor combinators, that allow to modify all function values of a function at once. Cf. 8http://conal.net/blog/posts/semantic-editor-combinators/Set the value of a field. ' as infix operator. This lets us write %first ^= 2+3 $ second ^= 5+7 $ record. jThis is a general function, but it is especially useful for setting many values of different type at once. Get the value of a field.  ' as infix operator. This lets us write record^.field^.subfield!. This imitates Modula II syntax. .Transform the value of a field by a function.  ' as infix operator. This lets us write field^:subfield^:(2*) $ record, record$%field^:subfield^:(2*) or "record$%field^:subfield^:(const 1).Flipped version of '($)'.YAccessor composition: Combine an accessor with an accessor to a sub-field. Speak "stack".)Accessor composition the other direction. (<.) = flip (.>)You may also use the (.) operator from Category class..Merge the accessors to two independent fields.!Independency means, it must hold: 9set (merge accA accB) (a,b) = set (merge accB accA) (b,a)HYou may construct smart accessors by composing a merged accessor with a  fromWrapper accessor.+This is a special case of the more general Point concept in the package fclabels.         Safe1Modify a record element and return its old value.1Modify a record element and return its new value.Infix variant of .Infix variant of .   Safe  Safe!Treat a Set like a boolean array.gTreats a finite map like an infinite map, where all undefined elements are replaced by a default value.KTreats a finite map like an infinite map, where all undefined elements are L and defined elements are M.    SafeN!"!"!"N!"Safe#%Access to the first value of a pair. $&Access to the second value of a pair. %'Access to the first value of a triple. &(Access to the second value of a triple. ''Access to the third value of a triple. #$%&'#$%&'#$%&'#$%&'Safe()*+,-./0123456789:;()*+,-./012345312/0-.;+,:9876()*45()*+,-./0123456789:; SafeOExample of using P, get, modify. QModify a value of the R function.S%Modify a value of a curried function.OTUVWXYZ[\]^_`QSabcdPefOTUVWXYZ[\]^_`QSabcdPefOTUVWXYZ[\]^_`QSabcdPefSafe <An  Accessor r aA is an object that encodes how to get and put a subject of type a out of/into an object of type s.0In order for an instance of this data structure a to be an <", it must obey the following laws: 7getVal a (setVal a x r) = x setVal a (getVal a r) r = r= Construct an < from a get and a set method.>@Get a value from a record field that is specified by an Accessor?>Set a value of a record field that is specified by an Accessor@YAccessor composition: Combine an accessor with an accessor to a sub-field. Speak "stack".A)Accessor composition the other direction. (<.) = flip (.>)You may also use the (.) operator from Category class.B*An "assignment operator" for state monads.  (=:) = putAC3A structural dereference function for state monads.D2A structural assignment function for state monads.E4A structural modification function for state monads. <= get method  set method > record field record !value of the field in the record ?record field f value x to be set original record new record with field f changed to x @ABCDE <=>?@ABCDE<=?> CDBE@A <=>?@ABCDE@ A Bg          ! "#$%&'()*+,-.//0123456789(:;<=>?@ABCDEFGHIJKLMNIOPIOQR S  IOT U V W X Y Z [ \ ] ^ _ `    a b # $ %cdataa_FQmPrGScWxhFGoB778luOPData.Accessor.BasicData.Accessor.MonadStateData.Accessor.ContainerData.Accessor.ShowData.Accessor.TupleData.Accessor.BinaryRead Data.AccessorData.Accessor.PrivateData.Accessor.MonadStatePrivateData.Accessor.ExampleT fromSetGetfromLens fromWrapperselfnullresultset^=composeget^.modify^:$%.><.merge getAndModify modifyAndGet%=%:liftliftTarray mapDefaultmapMaybe intMapDefault intMapMaybefield showsPrecfirstsecondfirst3second3third3Parser runParserByteCompatibletoByte ByteStreamgetWord8 ByteSource readWord8CanyStreamrecord$fCInt$fCChar$fCWord8$fByteSourceStateT$fByteCompatibleWord8$fByteStream[]AccessoraccessorgetValsetVal=:getAputAmodAbaseGHC.Err undefinedConsdecons $fCategory*TGHC.BaseNothingJusttoMaybeplainordresult2init initInfixreadinfix0infix1infix2infix3infix4 showsPairshow0show1accessHourMinutemergeHourMinute