[{"name":"Accessors","comment":" Accessors provide the ability to access nested data structures. Accessors\ncan be obtained by composing accessor combinators (also called Lenses):\n    \n    myRecord = {foo = {bar = \"Hello\"\n                      , qux = 3\n                      }\n               }\n\n    get (foo << bar) myRecord \n    -- returns \"Hello\"\n\n    set (foo << bar) \"Hi!\" myRecord\n    -- returns {foo = {bar = \"Hi!\", qux = 3}}\n\n    over (foo << qux) (+1) myRecord\n    -- returns {foo = {bar = \"Hello\", qux = 4}}\n\nIn the example above, foo, bar, qux, but also (foo << bar) and (foo << qux) are\naccessor combinators.\n\nAccessors and accessor combinators have full type checking: using an accessor on\nthe wrong type of data results in a compilation error:\n\n    get (foo << foo) myRecord \n\n    -- The 2nd argument to function `get` is causing a mismatch.\n    -- \n    -- 108|    get (foo << foo) myRecord\n    --                          ^^^^^^^^\n    -- Function `get` is expecting the 2nd\n    -- argument to be:\n    -- \n    --     { foo : { f | foo : ... } }\n    -- \n    -- But it is:\n    -- \n    --     { foo : { bar : ..., qux : ... } }\n\nAccessors and accessor combinators are purely functional. While you may get the\nlook and feel of mutable data structures, it's immutable all the way down.\n\n#Access functions\n@docs get, set, over\n\n# Accessor combinators\n@docs onEach, try\n\nFor an example on how to write, look the code for exampleFieldLens\n\n# Accessor\n@docs Accessor\n","unions":[{"name":"Accessor","comment":" An accessor is a record with a function that lets you get content inside a\ndata structure, and another function that lets you modify that content.\n\nThe super type parameter tracks the type of data structure that you will access.\nThe sub type parameter tracks the type of what you want to access within super.\n\nThe wrap type parameter tracks the type of data that get will return: for some\ndata structures such as records, wrap will always be equal to sub. However, for\nother data structures such as Maybe or List, there is not a 1:1 relation between\nthe container and the contained. The wrap type parameter tracks which containers\ncannot be discarded. \nA wrap type parameter will always look like (List sub) or Maybe (List sub) i.e.\nit will always have sub as its only type parameter.\n","args":["super","sub","wrap"],"cases":[["Accessor",["{ get : super -> wrap, over : (sub -> sub) -> super -> super }"]]]}],"aliases":[],"values":[{"name":"get","comment":" The get function takes:\n* An accessor combinator,\n* A datastructure that can be accessed using that combinator\nand returns the value accessed by that combinator.\n\n    get (foo << bar) myRecord \n","type":"(Accessors.Accessor a a a -> Accessors.Accessor b a c) -> b -> c"},{"name":"onEach","comment":" This accessor combinator lets you access values inside lists.\n\n    listRecord = {foo = [{ bar = 2}\n                        , {bar = 3}\n                        , {bar = 4}\n                        ]\n                 }\n\n    get (foo << onEach << bar) listRecord\n    -- returns [2, 3, 4] \n\n    over (foo << onEach << bar) (+1) listRecord\n    -- returns {foo = [{ bar = 3}, {bar = 4}, {bar = 5}] }\n","type":"Accessors.Accessor super sub wrap -> Accessors.Accessor (List.List super) sub (List.List wrap)"},{"name":"over","comment":"The over function takes:\n* An accessor combinator, \n* A function (type -> type), type being that which this combinator lets you access,\n* A datastructure that can be accessed using that combinator\nand it returns the data structure, with the accessible field changed by applying\nthe function to the existing value.\n\n    over (foo << qux) (+1) myRecord\n","type":"(Accessors.Accessor a a a -> Accessors.Accessor b a c) -> (a -> a) -> b -> b"},{"name":"set","comment":"The set function takes:\n* An accessor combinator, \n* A value of the type that this combinator lets you access,\n* A datastructure that can be accessed using that combinator\nand it returns the data structure, with the accessible field changed to be\nthe set value.\n\n    set (foo << bar) \"Hi!\" myRecord\n","type":"(Accessors.Accessor a a a -> Accessors.Accessor b a c) -> a -> b -> b"},{"name":"try","comment":" This accessor combinator lets you access values inside Maybe.\n\n    maybeRecord = { foo = Just { bar = 2}\n                  , qux = Nothing\n                  }\n\n    get (foo << try << bar) listRecord\n    -- returns Just 2\n\n    get (qux << try << bar) listRecord\n    -- returns Nothing\n\n    over (foo << try << bar) (+1) listRecord\n    -- returns { foo = Just { bar = 3} , qux = Nothing }\n\n    over (qux << try << bar) (+1) listRecord\n    -- returns { foo = Just { bar = 2} , qux = Nothing }\n","type":"Accessors.Accessor super sub wrap -> Accessors.Accessor (Maybe.Maybe super) sub (Maybe.Maybe wrap)"}],"binops":[]}]