úÎ!]ÑXmC      !"#$%&'()*+,-./0123456789:;<=>?@AB Safe© Safe ¦ data-accessorº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 C in the implementation of the get function.DEFGSafe0  data-accessorIf 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.  data-accessorAccess the record itself  data-accessor(Access a (non-existing) element of type ()  data-accessorresult 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/  data-accessorSet the value of a field.  data-accessor ' as infix operator. This lets us write %first ^= 2+3 $ second ^= 5+7 $ record. data-accessorjThis is a general function, but it is especially useful for setting many values of different type at once. data-accessorGet the value of a field.  data-accessor' as infix operator. This lets us write record^.field^.subfield!. This imitates Modula II syntax. data-accessor.Transform the value of a field by a function.  data-accessor' as infix operator. This lets us write field^:subfield^:(2*) $ record, record$%field^:subfield^:(2*) or "record$%field^:subfield^:(const 1). data-accessorFlipped version of '($)'. data-accessorYAccessor composition: Combine an accessor with an accessor to a sub-field. Speak "stack". data-accessor)Accessor composition the other direction. (<.) = flip (.>)You may also use the (.) operator from Category class. data-accessor.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.  58509 9  Safe4j data-accessor1Modify a record element and return its old value. data-accessor1Modify a record element and return its new value. data-accessorInfix variant of . data-accessorInfix variant of .  11Safe4ë   Safe9í" data-accessor!Treat a Set like a boolean array.# data-accessorgTreats a finite map like an infinite map, where all undefined elements are replaced by a default value.$ data-accessorKTreats a finite map like an infinite map, where all undefined elements are H and defined elements are I.!"#$%&!"#$%&Safe:S'()*+,-.,*+'()-.SafeOÙ 2 data-accessorAn  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 2", it must obey the following laws: 7getVal a (setVal a x r) = x setVal a (getVal a r) r = r3 data-accessor Construct an 2 from a get and a set method.4 data-accessor@Get a value from a record field that is specified by an Accessor5 data-accessor>Set a value of a record field that is specified by an Accessor6 data-accessorYAccessor composition: Combine an accessor with an accessor to a sub-field. Speak "stack".7 data-accessor)Accessor composition the other direction. (<.) = flip (.>)You may also use the (.) operator from Category class.8 data-accessor*An "assignment operator" for state monads.  (=:) = putA9 data-accessor3A structural dereference function for state monads.: data-accessor2A structural assignment function for state monads.; data-accessor4A structural modification function for state monads.3 data-accessor get method  data-accessor set method 4 data-accessor record field  data-accessorrecord  data-accessor!value of the field in the record 5 data-accessorrecord field f  data-accessorvalue x to be set  data-accessororiginal record  data-accessornew record with field f changed to x 23456789:;23549:8;6769 79 81SafePÀ<=<=SafeU@> data-accessor%Access to the first value of a pair. ? data-accessor&Access to the second value of a pair. @ data-accessor'Access to the first value of a triple. A data-accessor(Access to the second value of a triple. B data-accessor'Access to the third value of a triple. >?@AB>?@AB SafeX J data-accessorExample of using K, get, modify. L data-accessorModify a value of the M function.N data-accessor%Modify a value of a curried function.JOPQRSTUVWXYZ[LN\]^_K`ab    !"#    $ % & ' ( )*+,-.//0123456789:;<!"=>?@4ABCDEFGHI J K  GLMGLN O  GPQ R S T U V W X Y Z [ \ ]   # ^ _ * + ,`*data-accessor-0.2.3-Lb0WYvRNBhPFeCxO7EPOMGData.Accessor.BinaryReadData.Accessor.BasicData.Accessor.MonadStateData.Accessor.Container Data.AccessorData.Accessor.ShowData.Accessor.TupleData.Accessor.ByteSourceData.Accessor.PrivateData.Accessor.MonadStatePrivateData.Accessor.Example ByteSource readWord8 ByteStreamgetWord8ByteCompatibletoByteT fromSetGetfromLens fromWrapperselfnullresultset^=composeget^.modify^:$%.><.merge getAndModify modifyAndGet%=%:liftliftTarray mapDefaultmapMaybe intMapDefault intMapMaybeParser runParserCanyStreamfieldrecord$fCInt$fCChar$fCWord8AccessoraccessorgetValsetVal=:getAputAmodA showsPrecfirstsecondfirst3second3third3baseGHC.Err undefinedConsdecons GHC.MaybeNothingJustplainGHC.Baseordresult2init initInfixreadinfix0infix1infix2infix3infix4 showsPairshow0show1accessHourMinutemergeHourMinute