-
Notifications
You must be signed in to change notification settings - Fork 0
/
Eta-Prelude-Classes-Functor.html
15 lines (15 loc) · 4.06 KB
/
Eta-Prelude-Classes-Functor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!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>Eta.Prelude.Classes.Functor</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Eta-Prelude-Classes-Functor.html");};
//]]>
</script></head><body class="no-frame"><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption empty"> </p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe</td></tr></table><p class="caption">Eta.Prelude.Classes.Functor</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Map forward</a></li><li><a href="#g:2">Map backwards</a></li><li><a href="#g:3">Discard</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The <code>Functor</code> type class defines that a type
can have a <code><a href="Eta-Prelude-Classes-Functor.html#v:map">map</a></code> operation which can be used
to map a function over the elements of it.</p><p>The list and the <code>Maybe</code> types are examples of
instances of <code>Functor</code>.</p><p><em>Mnemonic: Mappable</em></p></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:map">map</a> :: Functor f => (a -> b) -> f a -> f b</li><li class="src short"><a href="#v:-124--36--62-">(|$>)</a> :: Functor f => f a -> (a -> b) -> f b</li><li class="src short"><a href="#v:-60--36--124-">(<$|)</a> :: Functor f => (a -> b) -> f a -> f b</li><li class="src short"><a href="#v:discard">discard</a> :: Functor f => f a -> f ()</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a id="v:map" class="def">map</a> :: Functor f => (a -> b) -> f a -> f b <a href="#v:map" class="selflink">#</a></p><div class="doc"><p>Maps a function over a value</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>map (+1) [1,2,3]
</code></strong>[2,3,4]
</pre></div></div><h3 id="g:1">Map forward</h3><div class="top"><p class="src"><a id="v:-124--36--62-" class="def">(|$>)</a> :: Functor f => f a -> (a -> b) -> f b <a href="#v:-124--36--62-" class="selflink">#</a></p><div class="doc"><p>Maps the function of the right to the Functor of the left:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>[1,2,3] |$> (+ 1)
</code></strong>[2,3,4]
</pre></div></div><h3 id="g:2">Map backwards</h3><div class="top"><p class="src"><a id="v:-60--36--124-" class="def">(<$|)</a> :: Functor f => (a -> b) -> f a -> f b <a href="#v:-60--36--124-" class="selflink">#</a></p><div class="doc"><p>Maps the function of the left to the Functor of the right:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>(+1) <$| [1,2,3]
</code></strong>[2,3,4]
</pre></div></div><h3 id="g:3">Discard</h3><div class="top"><p class="src"><a id="v:discard" class="def">discard</a> :: Functor f => f a -> f () <a href="#v:discard" class="selflink">#</a></p><div class="doc"><p>Discards the value inside of the functor.</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>discard [1,2,3]
</code></strong>[(),(),()]
</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.4</p></div></body></html>