/usr/share/doc/libghc-lens-doc/html/Data-Map-Lens.html is in libghc-lens-doc 4.15.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.Map.Lens</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-Map-Lens.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Map-Lens.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">lens-4.15.4: Lenses, Folds and Traversals</p></div><div id="content"><div id="module-header"><table class="info"><tr><th valign="top">Copyright</th><td>(C) 2014-2016 Edward Kmett</td></tr><tr><th>License</th><td>BSD-style (see the file LICENSE)</td></tr><tr><th>Maintainer</th><td>Edward Kmett <ekmett@gmail.com></td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Portability</th><td>non-portable</td></tr><tr><th>Safe Haskell</th><td>Safe</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Map.Lens</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>One of most commonly-asked questions about this package is whether
it provides lenses for working with <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html#v:Map">Map</a></code>. It does, but their uses
are perhaps obscured by their genericity. This module exists to provide
documentation for them.</p><p><code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html#v:Map">Map</a></code> is an instance of <code><a href="Control-Lens-At.html#v:At">At</a></code>, so we have a lenses
on values at keys:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>Map.fromList [(1, "world")] ^.at 1
</code></strong>Just "world"
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>at 1 .~ Just "world" $ Map.empty
</code></strong>fromList [(1,"world")]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>at 0 ?~ "hello" $ Map.empty
</code></strong>fromList [(0,"hello")]
</pre><p>We can traverse, fold over, and map over key-value pairs in a
<code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html#v:Map">Map</a></code>, thanks to its <code><a href="Control-Lens-Indexed.html#v:TraversableWithIndex">TraversableWithIndex</a></code>,
<code><a href="Control-Lens-Indexed.html#v:FoldableWithIndex">FoldableWithIndex</a></code>, and
<code><a href="Control-Lens-Indexed.html#v:FunctorWithIndex">FunctorWithIndex</a></code> instances.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>imap const $ Map.fromList [(1, "Venus")]
</code></strong>fromList [(1,1)]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>ifoldMap (\i _ -> Sum i) $ Map.fromList [(2, "Earth"), (3, "Mars")]
</code></strong>Sum {getSum = 5}
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>itraverse_ (curry print) $ Map.fromList [(4, "Jupiter")]
</code></strong>(4,"Jupiter")
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>itoList $ Map.fromList [(5, "Saturn")]
</code></strong>[(5,"Saturn")]
</pre><p>A related class, <code><a href="Control-Lens-At.html#v:Ixed">Ixed</a></code>, allows us to use
<code><a href="Control-Lens-At.html#v:ix">ix</a></code> to traverse a value at a particular key.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>ix 2 %~ ("New " ++) $ Map.fromList [(2, "Earth")]
</code></strong>fromList [(2,"New Earth")]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>preview (ix 8) $ Map.empty
</code></strong>Nothing
</pre><p>Additionally, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map.html#v:Map">Map</a></code> has <code><a href="Control-Lens-Traversal.html#v:TraverseMin">TraverseMin</a></code> and
<code><a href="Control-Lens-Traversal.html#v:TraverseMax">TraverseMax</a></code> instances, which let us traverse over
the value at the least and greatest keys, respectively.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>preview traverseMin $ Map.fromList [(5, "Saturn"), (6, "Uranus")]
</code></strong>Just "Saturn"
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>preview traverseMax $ Map.fromList [(5, "Saturn"), (6, "Uranus")]
</code></strong>Just "Uranus"
</pre></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:toMapOf">toMapOf</a> :: <a href="Control-Lens-Getter.html#t:IndexedGetting">IndexedGetting</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a> i a) s a -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a> i a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:toMapOf" class="def">toMapOf</a> :: <a href="Control-Lens-Getter.html#t:IndexedGetting">IndexedGetting</a> i (<a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a> i a) s a -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a> i a <a href="src/Data-Map-Lens.html#toMapOf" class="link">Source</a> <a href="#v:toMapOf" class="selflink">#</a></p><div class="doc"><p>Construct a map from a <code>IndexedGetter</code>, <code><a href="Control-Lens-Fold.html#v:IndexedFold">IndexedFold</a></code>, <code><a href="Control-Lens-Traversal.html#v:IndexedTraversal">IndexedTraversal</a></code> or <code><a href="Control-Lens-Lens.html#v:IndexedLens">IndexedLens</a></code></p><p>The construction is left-biased (see <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#v:union">union</a></code>), i.e. the first
occurences of keys in the fold or traversal order are preferred.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>toMapOf folded ["hello", "world"]
</code></strong>fromList [(0,"hello"),(1,"world")]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>toMapOf (folded . ifolded) [('a',"alpha"),('b', "beta")]
</code></strong>fromList [('a',"alpha"),('b',"beta")]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>toMapOf (folded <.> folded) ["foo", "bar"]
</code></strong>fromList [((0,0),'f'),((0,1),'o'),((0,2),'o'),((1,0),'b'),((1,1),'a'),((1,2),'r')]
</pre><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>toMapOf ifolded $ Map.fromList [('a', "hello"), ('b', "world")]
</code></strong>fromList [('a',"hello"),('b',"world")]
</pre><pre><code><a href="Data-Map-Lens.html#v:toMapOf">toMapOf</a></code> :: <code>IndexedGetter</code> i s a -> s -> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a></code> i a
<code><a href="Data-Map-Lens.html#v:toMapOf">toMapOf</a></code> :: <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a></code> i => <code>IndexedFold</code> i s a -> s -> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a></code> i a
<code><a href="Data-Map-Lens.html#v:toMapOf">toMapOf</a></code> :: <code>IndexedLens'</code> i s a -> s -> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a></code> i a
<code><a href="Data-Map-Lens.html#v:toMapOf">toMapOf</a></code> :: <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a></code> i => <code>IndexedTraversal'</code> i s a -> s -> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.7.1/Data-Map-Lazy.html#t:Map">Map</a></code> i a
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|