7 lines
7.0 KiB
HTML
7 lines
7.0 KiB
HTML
<!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.Either.Utils</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
|
|
window.onload = function () {pageLoad();setSynopsis("mini_Data-Either-Utils.html");};
|
|
//]]>
|
|
</script></head><body><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">MissingH-1.3.0.1: Large utility library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2004-2011 John Goerzen</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>John Goerzen <jgoerzen@complete.org> </td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.Either.Utils</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Utilities for working with the Either data type</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:maybeToEither">maybeToEither</a> :: MonadError e m => e -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a -> m a</li><li class="src short"><a href="#v:forceEither">forceEither</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Text-Show.html#t:Show">Show</a> e => <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> e a -> a</li><li class="src short"><a href="#v:forceEitherMsg">forceEitherMsg</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Text-Show.html#t:Show">Show</a> e => <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> e a -> a</li><li class="src short"><a href="#v:eitherToMonadError">eitherToMonadError</a> :: MonadError e m => <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> e a -> m a</li><li class="src short"><a href="#v:fromLeft">fromLeft</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> a b -> a</li><li class="src short"><a href="#v:fromRight">fromRight</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> a b -> b</li><li class="src short"><a href="#v:fromEither">fromEither</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> a a -> a</li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:maybeToEither" class="def">maybeToEither</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: MonadError e m</td><td class="doc empty"> </td></tr><tr><td class="src">=> e</td><td class="doc"><p>(Left e) will be returned if the Maybe value is Nothing</p></td></tr><tr><td class="src">-> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Maybe.html#t:Maybe">Maybe</a> a</td><td class="doc"><p>(Right a) will be returned if this is (Just a)</p></td></tr><tr><td class="src">-> m a</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Converts a Maybe value to an Either value, using the supplied parameter
|
|
as the Left value if the Maybe is Nothing.</p><p>This function can be interpreted as:</p><pre>maybeToEither :: e -> Maybe a -> Either e a</pre><p>Its definition is given as it is so that it can be used in the Error and related monads.</p></div></div><div class="top"><p class="src"><a name="v:forceEither" class="def">forceEither</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Text-Show.html#t:Show">Show</a> e => <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> e a -> a</p><div class="doc"><p>Pulls a <a href="Right.html">Right</a> value out of an Either value. If the Either value is
|
|
Left, raises an exception with "error". </p></div></div><div class="top"><p class="src"><a name="v:forceEitherMsg" class="def">forceEitherMsg</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Text-Show.html#t:Show">Show</a> e => <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a> -> <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> e a -> a</p><div class="doc"><p>Like <code><a href="Data-Either-Utils.html#v:forceEither">forceEither</a></code>, but can raise a specific message with the error. </p></div></div><div class="top"><p class="src"><a name="v:eitherToMonadError" class="def">eitherToMonadError</a> :: MonadError e m => <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> e a -> m a</p><div class="doc"><p>Takes an either and transforms it into something of the more generic
|
|
MonadError class. </p></div></div><div class="top"><p class="src"><a name="v:fromLeft" class="def">fromLeft</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> a b -> a</p><div class="doc"><p>Take a Left to a value, crashes on a Right</p></div></div><div class="top"><p class="src"><a name="v:fromRight" class="def">fromRight</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> a b -> b</p><div class="doc"><p>Take a Right to a value, crashes on a Left</p></div></div><div class="top"><p class="src"><a name="v:fromEither" class="def">fromEither</a> :: <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-Either.html#t:Either">Either</a> a a -> a</p><div class="doc"><p>Take an Either, and return the value inside it</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html> |